class
SymbolBase class for all symbols (logical code constructs) such as modules, types, functions, variables, etc.
Derived classes
- class AssertionPortSymbol final
- Represents a formal argument / port of an assertion construct, such as a sequence, property, or let construct.
- class CheckerSymbol final
- Represents a checker declaration.
- class ClockingBlockSymbol final
- Represents a clocking block.
- class CompilationUnitSymbol final
- The root of a single compilation unit.
- class ConfigBlockSymbol final
- Represents a config block declaration.
- class ConstraintBlockSymbol final
- Represents a named constraint block declaration within a class.
- class ContinuousAssignSymbol final
- Represents a continuous assignment statement.
- class CoverCrossBodySymbol final
- Represents the body of a cover cross type, separated out because the members of the cross body can't be accessed outside of the cross itself.
- class CovergroupBodySymbol final
- Represents the body of a covergroup type, separated out because the arguments of a covergroup need to live in their own scope so that they can be shadowed by body members.
- class DefParamSymbol final
- Represents a defparam directive.
- class DefinitionSymbol final
- Represents a module, interface, or program definition.
- class ElabSystemTaskSymbol final
- Represents an elaboration system task, such as $error or $warning.
- class EmptyMemberSymbol final
- Represents an empty member, i.e.
- class ExplicitImportSymbol final
- Represents an explicit import from a package.
- class ForwardingTypedefSymbol final
- A forward declaration of a user-defined type name.
- class GenerateBlockArraySymbol final
- Represents an array of generate blocks, as generated by a loop generate construct.
- class GenerateBlockSymbol final
- Represents blocks that are instantiated by a loop generate or conditional generate construct.
- class GenericClassDefSymbol final
- Represents a generic class definition, which is a parameterized class that has not yet had its parameter values specified.
- class GenvarSymbol final
- Represents a genvar declaration.
- class InstanceSymbolBase
- Common functionality for module, interface, program, and primitive instances.
- class InterfacePortSymbol final
- Represents the public-facing side of a module / program / interface port that is also a connection to an interface instance (optionally with a modport restriction).
- struct InvalidSymbol final
- A placeholder symbol type that represents an unknown or invalid symbol.
- class LetDeclSymbol final
- Represents a let declaration.
- class ModportClockingSymbol final
- Represents a clocking block port.
- class ModportSymbol final
- Represents a modport within an interface definition.
- class MultiPortSymbol final
- Represents a multi-port, which is a port symbol that externally appears as a single connection but internally connects to multiple names, potentially with varying directions.
- class NetType final
- Base class for all net types in SystemVerilog.
- class PackageSymbol final
- A SystemVerilog package construct.
- class PortSymbol final
- Represents the public-facing side of a module / program / interface port.
- class PropertySymbol final
- Represents a named property object.
- class RootSymbol final
- Represents the entirety of a design, along with all contained compilation units.
- class SequenceSymbol final
- Represents a named sequence object.
- class SubroutineSymbol final
- Represents a subroutine (task or function).
- class TransparentMemberSymbol final
- A class that wraps a hoisted transparent type member, such as an enum value or a symbol inherited from a base class, into a scope.
- class Type
- Base class for all data types in SystemVerilog.
- class UninstantiatedDefSymbol final
- Represents an instance of a definition (module / interface / program / checker) that is not actually instantiated in the design.
- class ValueSymbol
- A base class for symbols that represent a value (for example a variable or a parameter).
- class WildcardImportSymbol final
- Represents a wildcard import declaration.
Public functions
- auto getParentScope() const -> const Scope*
- Gets the logical parent scope that contains this symbol.
- auto getHierarchicalParent() const -> const Scope*
- Gets the parent scope of this symbol in terms of its hierarchy location.
-
auto getSyntax() const -> const syntax::
SyntaxNode* - Gets the syntax node that was used to create this symbol, if any.
- auto isScope() const -> bool
- Determines whether this symbol also represents a scope.
- auto isType() const -> bool
- Determines whether this symbol represents a type.
- auto isValue() const -> bool
- Determines whether this symbol represents a value.
- auto getDeclaredType() const -> const DeclaredType*
- If the symbol has a declared type, returns a pointer to it. Otherwise returns nullptr.
-
auto getHierarchicalPath() const -> std::
string - Gets the symbol's hierarchical path.
-
void appendHierarchicalPath(std::
string& buffer) const - Gets the symbol's hierarchical path by walking up to the root node and appending each parent's name to the provided buffer.
-
void appendLexicalPath(std::
string& buffer) const - Gets the symbol's lexical path by walking up to the compilation unit and appending each parent's name to the provided buffer.
-
auto isDeclaredBefore(const Symbol& symbol) const -> std::
optional<bool> - Determines whether this symbol is considered to be declared before the given symbol, in the same compilation unit.
- auto getDeclaringDefinition() const -> const DefinitionSymbol*
- Gets the definition in which this symbol is declared.
- auto getSourceLibrary() const -> const SourceLibrary*
- Gets the source library that contains this symbol.
- auto getRandMode() const -> RandMode
- If this symbol is a random variable, returns its mode.
-
void setAttributes(const Scope& scope,
std::
span<const syntax:: AttributeInstanceSyntax*const> syntax) - Sets the attributes associated with this symbol.
-
template<typename T>auto as() -> decltype(auto)
- Casts this symbol to the given concrete derived type.
-
template<typename T>auto as_if() -> decltype(auto)
- Tries to cast this symbol to the given concrete derived type.
-
template<typename T>auto as() const -> const T&
- Casts this symbol to the given concrete derived type.
-
template<typename T>auto as_if() const -> const T*
- Tries to cast this symbol to the given concrete derived type.
- auto getIndex() const -> SymbolIndex
- Gets the index of the symbol within its parent scope, which can be used to determine the relative ordering of scope members.
- void setIndex(SymbolIndex index)
- Sets the index of this symbol within its parent scope.
-
void setSyntax(const syntax::
SyntaxNode& node) - Sets the syntax that was used to create this symbol.
- auto getNextSibling() const -> const Symbol*
- Returns the next sibling symbol in the parent scope, if one exists.
- void setParent(const Scope& scope)
- Sets the parent scope of this symbol.
- void setParent(const Scope& scope, SymbolIndex index)
- Sets the parent scope of this symbol.
-
template<typename TVisitor, typename... Args>auto visit(TVisitor&& visitor, Args && ... args) const -> decltype(auto)
- Visits this symbol's concrete derived type via the provided visitor object.
Public variables
- SymbolKind kind
- The type of symbol.
-
std::
string_view name - The name of the symbol; if the symbol does not have a name, this will be an empty string.
- SourceLocation location
- The declared location of the symbol in the source code, or an empty location if it was not explicitly declared in the source text.
Function documentation
const Scope* slang:: ast:: Symbol:: getHierarchicalParent() const
Gets the parent scope of this symbol in terms of its hierarchy location.
This is the same as getParentScope except for instance body symbols.
const syntax:: SyntaxNode* slang:: ast:: Symbol:: getSyntax() const
Gets the syntax node that was used to create this symbol, if any.
Symbols can be created without any originating syntax; in those cases, this returns nullptr.
std:: optional<bool> slang:: ast:: Symbol:: isDeclaredBefore(const Symbol& symbol) const
Determines whether this symbol is considered to be declared before the given symbol, in the same compilation unit.
If it is, this method returns true. Otherwise it returns false. If the given symbol is not even in the same compilation unit as this one, returns std::nullopt.
const DefinitionSymbol* slang:: ast:: Symbol:: getDeclaringDefinition() const
Gets the definition in which this symbol is declared.
If the symbol isn't declared in a definition, returns nullptr.
RandMode slang:: ast:: Symbol:: getRandMode() const
If this symbol is a random variable, returns its mode.
Otherwise returns RandMode::None.
template<typename T>
decltype(auto) slang:: ast:: Symbol:: as()
Casts this symbol to the given concrete derived type.
Asserts that the type is appropriate given this symbol's kind.
template<typename T>
decltype(auto) slang:: ast:: Symbol:: as_if()
Tries to cast this symbol to the given concrete derived type.
If the type is not appropriate given this symbol's kind, returns nullptr.
template<typename T>
const T& slang:: ast:: Symbol:: as() const
Casts this symbol to the given concrete derived type.
Asserts that the type is appropriate given this symbol's kind.
template<typename T>
const T* slang:: ast:: Symbol:: as_if() const
Tries to cast this symbol to the given concrete derived type.
If the type is not appropriate given this symbol's kind, returns nullptr.
void slang:: ast:: Symbol:: setParent(const Scope& scope,
SymbolIndex index)
Sets the parent scope of this symbol.
Typically this is not called directly; add the symbol to the scope via the Scope::addMember method.