Replace Either with std::variant (#1731)

This commit is contained in:
Rangi
2025-07-08 13:59:03 -04:00
committed by GitHub
parent 35962dedc4
commit fda54fd0c3
17 changed files with 94 additions and 271 deletions

View File

@@ -7,8 +7,8 @@
#include <stdint.h>
#include <string>
#include <variant>
#include "either.hpp"
#include "linkdefs.hpp"
struct FileStackNode;
@@ -27,14 +27,14 @@ struct Symbol {
ExportLevel type;
FileStackNode const *src;
int32_t lineNo;
Either<
std::variant<
int32_t, // Constants just have a numeric value
Label // Label values refer to an offset within a specific section
>
data;
Label &label() { return data.get<Label>(); }
Label const &label() const { return data.get<Label>(); }
Label &label() { return std::get<Label>(data); }
Label const &label() const { return std::get<Label>(data); }
};
void sym_ForEach(void (*callback)(Symbol &));