class
#include <slang/ast/Scope.h>
Scope Base class for symbols that represent a name scope; that is, they contain children and can participate in name lookup.
Derived classes
- class ClassType
- Represents a class definition type.
- class ClockingBlockSymbol
- Represents a clocking block.
- class CompilationUnitSymbol
- The root of a single compilation unit.
- class ConstraintBlockSymbol
- Represents a named constraint block declaration within a class.
- class CoverCrossBodySymbol
- class CovergroupBodySymbol
- class CovergroupType
- Represents a covergroup definition type.
- class EnumType
- Represents an enumerated type.
- class GenerateBlockArraySymbol
- Represents an array of generate blocks, as generated by a loop generate construct.
- class GenerateBlockSymbol
- class LetDeclSymbol
- Represents a let declaration.
- class ModportSymbol
- Represents a modport within an interface definition.
- class PackageSymbol
- A SystemVerilog package construct.
- class PackedStructType
- Represents a packed structure of members.
- class PackedUnionType
- Represents a packed union of members.
- class PropertySymbol
- Represents a named property object.
- class RootSymbol
- Represents the entirety of a design, along with all contained compilation units.
- class SequenceSymbol
- Represents a named sequence object.
- class SubroutineSymbol
- Represents a subroutine (task or function).
- class UnpackedStructType
- Represents an unpacked structure of members.
- class UnpackedUnionType
- Represents an unpacked union of members.
Public types
- class iterator
- An iterator for members in the scope.
Public functions
- void addMember(const Symbol& symbol)
- Adds a symbol as a member to the scope.
-
void addMembers(const syntax::
SyntaxNode& syntax) - Creates and adds one or more member symbols to the scope from the given syntax node.
- auto getCompilation() const -> Compilation&
- Gets the compilation that contains this scope.
- auto getDefaultNetType() const -> const NetType&
- Gets the default net type for implicit nets in this scope.
- auto getTimeScale() const -> std::optional<TimeScale>
- Gets the time scale for delay values expressed within this scope.
- auto isProceduralContext() const -> bool
- auto getContainingInstance() const -> const InstanceBodySymbol*
- auto isUninstantiated() const -> bool
- auto find(std::string_view name) const -> const Symbol*
-
template<typename T>auto find(std::string_view name) const -> const T&
-
auto lookupName(std::string_view name,
LookupLocation location = LookupLocation::
max, bitmask<LookupFlags> flags = LookupFlags:: None) const -> const Symbol* -
template<typename T>auto lookupName(std::string_view name, LookupLocation location = LookupLocation::
max, bitmask<LookupFlags> flags = LookupFlags:: None) const -> const T& -
template<typename T>auto memberAt(uint32_t index) const -> const T&
- auto empty() const -> bool
- Checks whether the scope is empty (has no members).
-
auto members() const -> iterator_
range<iterator> - Gets an iterator to the members contained in the scope.
-
template<typename T>auto membersOfType() const -> iterator_
range<specific_ symbol_ iterator<T>> - Gets an iterator to all of the members of the given type contained in the scope.
- auto getFirstMember() const -> const Symbol*
- auto getLastMember() const -> const Symbol*
Protected functions
- void ensureElaborated() const
- void setNeedElaboration()
- Flag the need for this scope to be elaborated before members are accessed.
- void addWildcardImport(const WildcardImportSymbol& item)
- Add a preconstructed wildcard import to this scope.
Function documentation
bool slang:: ast:: Scope:: isProceduralContext() const
Returns true if this scope represents a procedural context; that is, a procedural block, or a task/function scope.
const InstanceBodySymbol* slang:: ast:: Scope:: getContainingInstance() const
Gets the instance body that contains this scope, if applicable. Otherwise returns nullptr.
bool slang:: ast:: Scope:: isUninstantiated() const
Returns true if this scope is in an uninstantiated context, like if in a module that is not used in the design.
const Symbol* slang:: ast:: Scope:: find(std::string_view name) const
Finds a direct child member with the given name. This won't return anything weird like forwarding typedefs or imported symbols, but will return things like transparent enum members. If no symbol is found with the given name, nullptr is returned.
template<typename T>
const T& slang:: ast:: Scope:: find(std::string_view name) const
Finds a direct child member with the given name. This won't return anything weird like forwarding typedefs or imported symbols, but will return things like transparent enum members. This method expects that the symbol will be found and be of the given type T
.
const Symbol* slang:: ast:: Scope:: lookupName(std::string_view name,
LookupLocation location = LookupLocation:: max,
bitmask<LookupFlags> flags = LookupFlags:: None) const
Performs a full fledged name lookup starting in the current scope, following all SystemVerilog rules for qualified or unqualified name resolution. The name to look up is parsed from the given input string.
template<typename T>
const T& slang:: ast:: Scope:: lookupName(std::string_view name,
LookupLocation location = LookupLocation:: max,
bitmask<LookupFlags> flags = LookupFlags:: None) const
Performs a full fledged name lookup starting in the current scope, following all SystemVerilog rules for qualified or unqualified name resolution. The name to look up is parsed from the given input string. This method expects that the symbol will be found and be of the given type T
.
template<typename T>
const T& slang:: ast:: Scope:: memberAt(uint32_t index) const
Gets a specific member at the given zero-based index, expecting it to be of the specified type. This expects (and asserts) that the member at the given index is of the specified type T
.
const Symbol* slang:: ast:: Scope:: getFirstMember() const
Gets a pointer to the first member in the scope. Note that this does not force elaboration of the scope.
const Symbol* slang:: ast:: Scope:: getLastMember() const
Gets a pointer to the last member in the scope. Note that this does not force elaboration of the scope.
void slang:: ast:: Scope:: ensureElaborated() const protected
Before we access any members to do lookups or return iterators, make sure the scope is fully elaborated.