20 std::optional<std::string> library;
22 std::optional<std::string> name;
24 std::optional<uint16_t> hint;
40 : library(library), name(name)
49 SymbolName(std::string library, std::string name, uint16_t hint)
50 : library(library), name(name), hint(hint)
60 : library(library), hint(ordinal)
67 bool LoadName(std::string& result)
const;
87 bool GetImportedName(std::string& result_library, std::string& result_name)
const;
92 bool GetImportedName(std::string& result_library, std::string& result_name, uint16_t& result_hint)
const;
113 std::ostream& operator<<(std::ostream& out,
const SymbolName& symbol);
123 std::optional<uint16_t> ordinal;
130 : by_ordinal(false), name(name), ordinal()
140 : by_ordinal(false), name(name), ordinal(hint)
148 : by_ordinal(true), name(internal_name), ordinal(ordinal)
152 bool IsExportedByOrdinal()
const;
157 bool LoadName(std::string& result)
const;
218 std::ostream& operator<<(std::ostream& out,
const ExportedSymbol& symbol);
227 offset_t size, align;
229 CommonSymbol(std::string name =
"", offset_t size = 0, offset_t align = 1)
230 : name(name), size(size), align(align)
235 std::ostream& operator<<(std::ostream& out,
const CommonSymbol& symbol);
Represents a currently unallocated variable that should be allocated in the final stages of the linki...
Definition symbol.h:224
Represents a symbol to be exported from the module.
Definition symbol.h:119
bool operator>(const ExportedSymbol &other) const
Compares two symbols for ordering.
Definition symbol.cc:249
bool operator<(const ExportedSymbol &other) const
Compares two symbols for ordering.
Definition symbol.cc:236
bool GetExportedByName(std::string &result) const
For symbols exported by name, returns the name.
Definition symbol.cc:167
bool operator>=(const ExportedSymbol &other) const
Compares two symbols for ordering.
Definition symbol.cc:244
bool operator!=(const ExportedSymbol &other) const
Compares two symbols for inequality.
Definition symbol.cc:231
bool operator<=(const ExportedSymbol &other) const
Compares two symbols for ordering.
Definition symbol.cc:254
ExportedSymbol(std::string name, uint16_t hint)
Creates a symbol exported by name, with a corresponding hint.
Definition symbol.h:139
bool LoadName(std::string &result) const
Returns the name of the symbol.
Definition symbol.cc:148
bool LoadOrdinalOrHint(uint16_t &result) const
Returns the hint or ordinal of the symbol.
Definition symbol.cc:154
bool GetExportedByOrdinal(uint16_t &result) const
For symbols exported by ordinal, returns the ordinal.
Definition symbol.cc:197
ExportedSymbol(std::string name)
Creates a symbol exported by name.
Definition symbol.h:129
bool operator==(const ExportedSymbol &other) const
Compares two symbols for equality.
Definition symbol.cc:226
ExportedSymbol(uint16_t ordinal, std::string internal_name)
Creates a symbol exported by ordinal, with an associated internal name.
Definition symbol.h:147
Represents an (imported or internal) symbol name, which can be more complex than a string.
Definition symbol.h:18
bool GetImportedOrdinal(std::string &result_library, uint16_t &result_ordinal) const
For symbols imported by ordinal, returns the library and ordinal.
Definition symbol.cc:92
bool operator!=(const SymbolName &other) const
Compares two symbols for inequality.
Definition symbol.cc:112
SymbolName(std::string library, uint16_t ordinal)
Creates a symbol imported via ordinal, from a library.
Definition symbol.h:59
SymbolName(std::string name)
Creates an internal symbol with a name.
Definition symbol.h:31
bool GetLocalName(std::string &result) const
For local symbols, returns the name.
Definition symbol.cc:45
bool LoadName(std::string &result) const
Retrieves the name of the symbol, if it has one.
Definition symbol.cc:6
SymbolName(std::string library, std::string name)
Creates a symbol imported via name, from a library.
Definition symbol.h:39
SymbolName(std::string library, std::string name, uint16_t hint)
Creates a symbol imported via name and a hint, from a library.
Definition symbol.h:49
bool LoadOrdinalOrHint(uint16_t &result) const
Retrieves the ordinal of symbols imported by ordinal, or the hint for imported symbols with a hint.
Definition symbol.cc:32
bool LoadLibraryName(std::string &result) const
Retrieves the name of the library, if it is imported.
Definition symbol.cc:19
bool GetImportedName(std::string &result_library, std::string &result_name) const
For symbols imported by name, returns the library and name.
Definition symbol.cc:60
bool operator==(const SymbolName &other) const
Compares two symbols for equality.
Definition symbol.cc:107