Represents a Symbol, which maps a name to an object in the IR.
More...
#include <Symbol.hpp>
|
| static Symbol * | Create (Context &C) |
| | Create an unitialized Symbol object. More...
|
| |
| static Symbol * | Create (Context &C, Addr X, const std::string &Name, bool AtEnd=false) |
| | Create a Symbol object. More...
|
| |
| static Symbol * | Create (Context &C, const std::string &Name, bool AtEnd=false) |
| | Create a Symbol object. More...
|
| |
| template<typename NodeTy > |
| static Symbol * | Create (Context &C, NodeTy *Referent, const std::string &Name, bool AtEnd=false) |
| | Create a Symbol object. More...
|
| |
| template<typename NodeTy > |
| static constexpr bool | is_supported_type () |
| |
| static Node * | Create (Context &C) |
| | Create a Node object in its default state. More...
|
| |
| static const Node * | getByUUID (const Context &C, const UUID &Uuid) |
| | Retrieve a node by its UUID. More...
|
| |
| static Node * | getByUUID (Context &C, const UUID &Uuid) |
| | Retrieve a node by its UUID. More...
|
| |
Represents a Symbol, which maps a name to an object in the IR.
◆ supported_referent_types
The list of supported referent types.
◆ Create() [1/4]
Create an unitialized Symbol object.
- Parameters
-
- Returns
- The newly created Symbol.
◆ Create() [2/4]
| static Symbol* gtirb::Symbol::Create |
( |
Context & |
C, |
|
|
Addr |
X, |
|
|
const std::string & |
Name, |
|
|
bool |
AtEnd = false |
|
) |
| |
|
inlinestatic |
Create a Symbol object.
- Parameters
-
| C | The Context in which this object will be held. |
| X | The address of the symbol. |
| Name | The name of the symbol. |
| AtEnd | If true, this symbol points to the end of its referent, rather than at the beginning. Defaults to false. |
- Returns
- The newly created object.
◆ Create() [3/4]
| static Symbol* gtirb::Symbol::Create |
( |
Context & |
C, |
|
|
const std::string & |
Name, |
|
|
bool |
AtEnd = false |
|
) |
| |
|
inlinestatic |
Create a Symbol object.
- Parameters
-
| C | The Context in which this object will be held. |
| Name | The name of the symbol. |
| AtEnd | If true, this symbol points to the end of its referent, rather than at the beginning. Defaults to false. |
- Returns
- The newly created object.
◆ Create() [4/4]
template<typename NodeTy >
| static Symbol* gtirb::Symbol::Create |
( |
Context & |
C, |
|
|
NodeTy * |
Referent, |
|
|
const std::string & |
Name, |
|
|
bool |
AtEnd = false |
|
) |
| |
|
inlinestatic |
Create a Symbol object.
- Parameters
-
| C | The Context in which this object will be held. |
| Referent | The DataBlock this symbol refers to. |
| Name | The name of the symbol. |
| AtEnd | If true, this symbol points to the end of its referent, rather than at the beginning. Defaults to false. |
- Returns
- The newly created object.
◆ getAddress()
| std::optional<Addr> gtirb::Symbol::getAddress |
( |
| ) |
const |
Get the effective address.
- Returns
- The effective address.
◆ getAtEnd()
| bool gtirb::Symbol::getAtEnd |
( |
| ) |
const |
|
inline |
If true, this symbol is pointing to the end of the referent rather than at the beginning.
This value has no meaning for integral symbols.
◆ getModule() [1/2]
| Module* gtirb::Symbol::getModule |
( |
| ) |
|
|
inline |
Get the Module this symbol belongs to.
◆ getModule() [2/2]
| const Module* gtirb::Symbol::getModule |
( |
| ) |
const |
|
inline |
Get the Module this symbol belongs to.
◆ getName()
| const std::string& gtirb::Symbol::getName |
( |
| ) |
const |
|
inline |
Get the name.
- Returns
- The name.
◆ getReferent() [1/2]
template<typename NodeTy >
| NodeTy* gtirb::Symbol::getReferent |
( |
| ) |
|
|
inline |
Get the referent to which this symbol refers.
- Template Parameters
-
| NodeTy | A Node type of a supported referent. |
- Returns
- The data, dynamically typed as the given
NodeTy, or null if there is no referent of that type.
◆ getReferent() [2/2]
template<typename NodeTy >
| const NodeTy* gtirb::Symbol::getReferent |
( |
| ) |
const |
|
inline |
Get the referent to which this symbol refers.
- Template Parameters
-
| NodeTy | A Node type of a supported referent. |
- Returns
- The data, dynamically typed as the given
NodeTy, or null if there is no referent of that type.
◆ hasReferent()
| bool gtirb::Symbol::hasReferent |
( |
| ) |
const |
|
inline |
Check if this symbol has a referent.
- Returns
true if the symbol has a referent, false otherwise.
◆ is_supported_type()
template<typename NodeTy >
| static constexpr bool gtirb::Symbol::is_supported_type |
( |
| ) |
|
|
inlinestaticconstexpr |
◆ setAddress()
| void gtirb::Symbol::setAddress |
( |
Addr |
A | ) |
|
|
inline |
Set the address of a symbol.
◆ setAtEnd()
| void gtirb::Symbol::setAtEnd |
( |
bool |
AE | ) |
|
|
inline |
sets whether or not this symbol is pointing to the end of the referent rather than at the beginning.
This value has no meaning for integral symbols.
◆ setName()
| void gtirb::Symbol::setName |
( |
const std::string & |
N | ) |
|
|
inline |
Set the name of a symbol.
◆ setReferent()
template<typename NodeTy >
| std::enable_if_t<is_supported_type<NodeTy>)> gtirb::Symbol::setReferent |
( |
NodeTy * |
N | ) |
|
|
inline |
Set the referent of a symbol.
If the referent of a symbol is set to null, then the value of the symbol's payload will be cleared (that is, hasReference will return false).
◆ visit()
template<typename Callable >
| auto gtirb::Symbol::visit |
( |
Callable && |
Visitor | ) |
const |
|
inline |
Visits the symbol's referent, if one is present, by concrete referent type.
- Template Parameters
-
| Callable | A callable function type. This type must be able to be called with a pointer to all of the types listed in supported_referent_types. All overloaded functions must have a common, compatible return type. |
- Parameters
-
| Visitor | A callable object that will be called with a nonnull symbol referent. |
- Returns
- The common type of each of the return types in the
Callable overload set. Notionally returns: std::common_type_t<Overload1(Ty1), Overload2(Ty2), ...> which can be void.
For example:
struct Visitor {
int operator()(CfgNode*) { return 0; }
long operator()(DataBlock*) { return 1; }
};
SymB->visit(Visitor{});
SymD->visit(Visitor{});
SymX->visit(Visitor{});
SymN->visit(Visitor{});
◆ Context
◆ Module
◆ SerializationTestHarness
| friend class SerializationTestHarness |
|
friend |
◆ toProtobuf
template<typename T >
| T::MessageType toProtobuf |
( |
const T & |
| ) |
|
|
friend |
The documentation for this class was generated from the following file: