class
#include <slang/ast/Statement.h>
Statement The base class for all statements in SystemVerilog.
Derived classes
- class BlockStatement
- Represents a sequential or parallel block statement.
- class BreakStatement
- Represents a break statement.
- class CaseStatement
- Represents a case statement.
- class ConcurrentAssertionStatement
- Represents a concurrent assertion statement.
- class ConditionalStatement
- Represents a conditional statement.
- class ContinueStatement
- Represents a continue statement.
- class DisableForkStatement
- Represents a
disable fork
statement. - class DisableStatement
- Represents a disable statement.
- class DoWhileLoopStatement
- Represents a
do
while
loop statement. - class EmptyStatement
- Represents an empty statement, used as a placeholder or an anchor for attributes.
- class EventTriggerStatement
- Represents an event triggering statement.
- class ExpressionStatement
- Represents an expression that is executed as a standalone statement.
- class ForLoopStatement
- Represents a
for
loop statement. - class ForeachLoopStatement
- Represents a
foreach
loop statement. - class ForeverLoopStatement
- Represents a
forever
loop statement. - class ImmediateAssertionStatement
- Represents an immediate assertion statement.
- class InvalidStatement
- Represents an invalid statement.
- class PatternCaseStatement
- Represents a pattern case statement.
- class ProceduralAssignStatement
- Represents a procedural
assign
statement. - class ProceduralCheckerStatement
- Represents a procedural checker instantiation statement.
- class ProceduralDeassignStatement
- Represents a procedural
deassign
statement. - class RandCaseStatement
- Represents a
randcase
statement. - class RandSequenceStatement
- Represents a
randsequence
statement. - class RepeatLoopStatement
- Represents a
repeat
loop statement. - class ReturnStatement
- Represents a return statement.
- class StatementList
- Represents a list of statements.
- class TimedStatement
- Represents a statement that has an associated timing control.
- class VariableDeclStatement
- Represents a variable declaration in a statement context.
- class WaitForkStatement
- Represents a
wait fork
statement. - class WaitOrderStatement
- Represents a
wait_order
statement. - class WaitStatement
- Represents a
wait
statement. - class WhileLoopStatement
- Represents a
while
loop statement.
Public types
- struct StatementContext
- Additional information passed along during statement creation.
- enum class EvalResult { Fail, Success, Return, Break, Continue, Disable }
- Specifies possible results of evaluating a statement.
Public static functions
- static auto bind(const StatementSyntax& syntax, const ASTContext& context, StatementContext& stmtCtx, bool inList = false, bool labelHandled = false) -> const Statement&
- Binds a statement tree from the given syntax nodes.
-
static auto bindBlock(const StatementBlockSymbol& block,
const syntax::
SyntaxNode& syntax, const ASTContext& context, StatementContext& stmtCtx) -> const Statement& - Binds a statement tree that forms the contents of a block.
-
static auto bindItems(const syntax::
SyntaxList<syntax:: SyntaxNode>& items, const ASTContext& context, StatementContext& stmtCtx) -> const Statement& - Binds a list of statement items.
-
static auto createBlockItems(const Scope& scope,
const StatementSyntax& syntax,
bool labelHandled,
SmallVector<const syntax::
SyntaxNode*>& extraMembers) -> std:: span<const StatementBlockSymbol*const> - Creates any symbols declared by the given statement syntax, such as local variables.
-
static auto createAndAddBlockItems(Scope& scope,
const syntax::
SyntaxList<syntax:: SyntaxNode>& items) -> std:: span<const StatementBlockSymbol*const> - Creates any symbols declared by the given list of syntax nodes, such as local variables, and ignores any statement syntax nodes.
-
static auto createAndAddBlockItems(Scope& scope,
const StatementSyntax& syntax,
bool labelHandled) -> std::
span<const StatementBlockSymbol*const> - Creates any symbols declared by the given statement syntax, such as local variables.
Public functions
- auto bad() const -> bool
- Indicates whether the statement is invalid.
- auto eval(EvalContext& context) const -> EvalResult
- Evaluates the statement under the given evaluation context.
-
template<typename T>auto as() -> T&
- Casts this statement to the given concrete derived type.
-
template<typename T>auto as() const -> const T&
- Casts this statement to the given concrete derived type.
-
template<typename T>auto as_if() -> T*
- Tries to cast this statement to the given concrete derived type.
-
template<typename T>auto as_if() const -> const T*
- Tries to cast this statement to the given concrete derived type.
-
template<typename TVisitor, typename... Args>auto visit(TVisitor&& visitor, Args && ... args) const -> decltype(auto)
- Visits this statement's concrete derived type via the provided visitor object.
Public variables
- StatementKind kind
- The kind of statement; indicates the type of derived class.
- const StatementSyntax* syntax
- The syntax used to create this statement, if it was parsed from a source file.
- SourceRange sourceRange
- The source range of this statement, if it originated from source code.
Enum documentation
enum class slang:: ast:: Statement:: EvalResult
Specifies possible results of evaluating a statement.
Enumerators | |
---|---|
Fail |
Evaluation totally failed and we should give up on any further processing. |
Success |
Evaluation succeeded. |
Return |
A return statement was invoked; we should exit the current function. |
Break |
A break statement was invoked; we should exit the current loop. |
Continue |
A continue statement was invoked; we should continue the current loop. |
Disable |
A disable statement was invoked; we should exit blocks until we find the target. |
Function documentation
static std:: span<const StatementBlockSymbol*const> slang:: ast:: Statement:: createAndAddBlockItems(Scope& scope,
const syntax:: SyntaxList<syntax:: SyntaxNode>& items)
Creates any symbols declared by the given list of syntax nodes, such as local variables, and ignores any statement syntax nodes.
The created symbols are added to the given scope.
static std:: span<const StatementBlockSymbol*const> slang:: ast:: Statement:: createAndAddBlockItems(Scope& scope,
const StatementSyntax& syntax,
bool labelHandled)
Creates any symbols declared by the given statement syntax, such as local variables.
The created symbols are added to the given scope.
template<typename T>
T& slang:: ast:: Statement:: as()
Casts this statement to the given concrete derived type.
Asserts that the type is appropriate given this statement's kind.
template<typename T>
const T& slang:: ast:: Statement:: as() const
Casts this statement to the given concrete derived type.
Asserts that the type is appropriate given this statement's kind.
template<typename T>
T* slang:: ast:: Statement:: as_if()
Tries to cast this statement to the given concrete derived type.
If the type is not appropriate given this statement's kind, returns nullptr.
template<typename T>
const T* slang:: ast:: Statement:: as_if() const
Tries to cast this statement to the given concrete derived type.
If the type is not appropriate given this statement's kind, returns nullptr.