class
#include <slang/ast/Symbol.h>
Symbol Base class for all symbols (logical code constructs) such as modules, types, functions, variables, etc.
Derived classes
- class AnonymousProgramSymbol final
- Represents an anonymous program.
- class AssertionPortSymbol final
- Represents a formal argument / port of an assertion construct, such as a sequence, property, or let construct.
- class AttributeSymbol final
- Represents an attribute attached to a symbol, such as (* foo = 42 *).
- class CheckerInstanceBodySymbol final
- The body of a checker instance, which acts as the scope for its members.
- 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 CoverCrossSymbol final
- Represents a cover cross declaration.
- class CoverageBinSymbol final
- Represents a coverage bin declaration.
- 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 CoverpointSymbol final
- Represents a coverpoint declaration.
- 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 InstanceArraySymbol final
- Represents an array of instances.
- class InstanceBodySymbol final
- The body of a module, interface, or program instance, which acts as the scope for its members.
- 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 MethodPrototypeSymbol final
- Represents a class method prototype.
- 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 NetAliasSymbol final
- Represents a net alias declaration.
- 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 PrimitiveSymbol final
- Represents a user-defined primitive (UDP) declaration.
- class ProceduralBlockSymbol final
- Represents a procedural block, such as an always block.
- class PropertySymbol final
- Represents a named property object.
- class PulseStyleSymbol final
- Represents a pulse style declaration.
- class RandSeqProductionSymbol final
- Represents a randsequence production.
- class RootSymbol final
- Represents the entirety of a design, along with all contained compilation units.
- class SequenceSymbol final
- Represents a named sequence object.
- class SpecifyBlockSymbol final
- Represents a specify block.
- class StatementBlockSymbol final
- Represents a statement block, either sequential or parallel.
- class SubroutineSymbol final
- Represents a subroutine (task or function).
- class SystemTimingCheckSymbol final
- Represents a system timing check declaration.
- class TimingPathSymbol final
- Represents a timing path declaration within a specify block.
- 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 TypeParameterSymbol final
- Represents a type parameter.
- 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
- const Scope* getParentScope() const
- Gets the logical parent scope that contains this symbol.
- const Scope* getHierarchicalParent() const
- Gets the parent scope of this symbol in terms of its hierarchy location.
-
const syntax::
SyntaxNode* getSyntax() const - Gets the syntax node that was used to create this symbol, if any.
- bool isScope() const
- Determines whether this symbol also represents a scope.
- bool isType() const
- Determines whether this symbol represents a type.
- bool isValue() const
- Determines whether this symbol represents a value.
- const DeclaredType* getDeclaredType() const
- If the symbol has a declared type, returns a pointer to it. Otherwise returns nullptr.
-
std::
string getHierarchicalPath() const - 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.
-
std::
optional<bool> isDeclaredBefore(const Symbol& symbol) const - Determines whether this symbol is considered to be declared before the given symbol, in the same compilation unit.
- const DefinitionSymbol* getDeclaringDefinition() const
- Gets the definition in which this symbol is declared.
- const SourceLibrary* getSourceLibrary() const
- Gets the source library that contains this symbol.
- RandMode getRandMode() const
- 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>decltype(auto) as()
- Casts this symbol to the given concrete derived type.
-
template<typename T>decltype(auto) as_if()
- Tries to cast this symbol to the given concrete derived type.
-
template<typename T>const T& as() const
- Casts this symbol to the given concrete derived type.
-
template<typename T>const T* as_if() const
- Tries to cast this symbol to the given concrete derived type.
- SymbolIndex getIndex() const
- 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.
- const Symbol* getNextSibling() const
- 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>decltype(auto) visit(TVisitor&& visitor, Args && ... args) const
- 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.