slang::ast::ClassType class

Represents a class definition type.

Base classes

class Type
Base class for all data types in SystemVerilog.
class Scope
Base class for symbols that represent a name scope; that is, they contain children and can participate in name lookup.

Public functions

auto getBaseClass() const -> const Type*
If this class derives from a base class, returns that type. Otherwise returns null.
auto getImplementedInterfaces() const -> std::span<const Type*const>
Gets the list of interface classes that this class implements.
auto getDeclaredInterfaces() const -> std::span<const Type*const>
Gets the list of interface classes that this class implements, as declared in the class type declaration (i.e.
auto getBaseConstructorCall() const -> const Expression*
If this class has a base class with a constructor, gets the expression used to invoke that method.
auto getBitstreamWidth() const -> uint32_t
Gets $bits of the type. Returns zero if the type does not have a statically known size.
void checkForwardDecls() const
Checks all forward declarations for validity when considering the target type of this alias.

Public variables

const GenericClassDefSymbol* genericClass
If the class type was specialized from a generic class, this is a pointer to that generic class definition.
bool isAbstract
Set to true if the class is an abstract class (declared with the "virtual" keyword).
bool isInterface
Set to true if the class is an interface class.

Function documentation

std::span<const Type*const> slang::ast::ClassType::getImplementedInterfaces() const

Gets the list of interface classes that this class implements.

If this class is itself an interface class, this is instead the list of interface classes that it extends from, if any.

Note that this list is flattened from the full set of all interfaces implemented by any base classes or interface class parents, up the inheritance hierarchy.

std::span<const Type*const> slang::ast::ClassType::getDeclaredInterfaces() const

Gets the list of interface classes that this class implements, as declared in the class type declaration (i.e.

it does not include any parent interfaces inherited from the ones in the declaration). If this class is itself an interface class, this is instead the list of interface classes that it extends from, if any.

const Expression* slang::ast::ClassType::getBaseConstructorCall() const

If this class has a base class with a constructor, gets the expression used to invoke that method.

Otherwise returns nullptr.

void slang::ast::ClassType::checkForwardDecls() const

Checks all forward declarations for validity when considering the target type of this alias.

Any inconsistencies will issue diagnostics.