The root of the AST hierarchy. More...
#include <AstBase.h>
Public Types | |
enum | AstKind { AST_SignatureDecl, AST_DomainDecl, AST_VarietyDecl, AST_FunctorDecl, AST_AddDecl, AST_AccessDecl, AST_CarrierDecl, AST_EnumerationDecl, AST_IncompleteTypeDecl, AST_IntegerDecl, AST_ArrayDecl, AST_RecordDecl, AST_AbstractDomainDecl, AST_DomainInstanceDecl, AST_PercentDecl, AST_SigInstanceDecl, AST_LoopDecl, AST_ObjectDecl, AST_ParamValueDecl, AST_RenamedObjectDecl, AST_ProcedureDecl, AST_FunctionDecl, AST_EnumLiteral, AST_PosAD, AST_ValAD, AST_ImportDecl, AST_ExceptionDecl, AST_ComponentDecl, AST_UniversalType, AST_FunctionType, AST_ProcedureType, AST_AccessType, AST_ArrayType, AST_DomainType, AST_EnumerationType, AST_IncompleteType, AST_IntegerType, AST_RecordType, AST_AllocatorExpr, AST_ConversionExpr, AST_DiamondExpr, AST_DeclRefExpr, AST_DereferenceExpr, AST_FunctionCallExpr, AST_IndexedArrayExpr, AST_InjExpr, AST_IntegerLiteral, AST_NullExpr, AST_AggregateExpr, AST_PrjExpr, AST_QualifiedExpr, AST_SelectedExpr, AST_StringLiteral, AST_FirstAE, AST_FirstArrayAE, AST_LastArrayAE, AST_LastAE, AST_AssignmentStmt, AST_BlockStmt, AST_ForStmt, AST_HandlerStmt, AST_IfStmt, AST_LoopStmt, AST_NullStmt, AST_ProcedureCallStmt, AST_RaiseStmt, AST_ReturnStmt, AST_StmtSequence, AST_WhileStmt, AST_PragmaStmt, AST_KeywordSelector, AST_DSTDefinition, AST_Range, AST_ArrayRangeAttrib, AST_ScalarRangeAttrib, AST_SubroutineRef, AST_TypeRef, AST_ExceptionRef, AST_Identifier, AST_ComponentKey, LAST_AstKind, FIRST_Decl = AST_SignatureDecl, LAST_Decl = AST_ComponentDecl, FIRST_ModelDecl = AST_SignatureDecl, LAST_ModelDecl = AST_FunctorDecl, FIRST_TypeDecl = AST_AccessDecl, LAST_TypeDecl = AST_PercentDecl, FIRST_DomainType = AST_AbstractDomainDecl, LAST_DomainType = AST_PercentDecl, FIRST_ValueDecl = AST_LoopDecl, LAST_ValueDecl = AST_RenamedObjectDecl, FIRST_SubroutineDecl = AST_ProcedureDecl, LAST_SubroutineDecl = AST_ValAD, FIRST_Type = AST_UniversalType, LAST_Type = AST_RecordType, FIRST_PrimaryType = AST_AccessType, LAST_PrimaryType = AST_RecordType, FIRST_Expr = AST_AllocatorExpr, LAST_Expr = AST_LastAE, FIRST_AttribExpr = AST_FirstAE, LAST_AttribExpr = AST_LastAE, FIRST_Stmt = AST_AssignmentStmt, LAST_Stmt = AST_PragmaStmt } |
Codes which identify concrete members of the AST hierarchy. More... | |
Public Member Functions | |
virtual | ~Ast () |
AstKind | getKind () const |
Accesses the code identifying this node. | |
virtual Location | getLocation () const |
bool | isValid () const |
void | markInvalid () |
Marks this node as invalid. | |
bool | isDeletable () const |
bool | denotesDecl () const |
Returns true if this node denotes a declaration. | |
bool | denotesModelDecl () const |
Returns true if this node denotes a Model. | |
bool | denotesTypeDecl () const |
Returns true if this node denotes a type declaration. | |
bool | denotesSubroutineDecl () const |
bool | denotesValueDecl () const |
Returns true if this node denotes a Value. | |
bool | denotesDomainTypeDecl () const |
Returns true if this node denotes a domain type decl. | |
bool | denotesType () const |
Returns true if this node denotes a Type. | |
bool | denotesPrimaryType () const |
Returns true if this node denotes a PrimaryType. | |
bool | denotesSubroutineType () const |
bool | denotesCompositeType () const |
Returns true if this node denotes a composite type. | |
bool | denotesExpr () const |
Returns true if this node denotes a expression. | |
bool | denotesAttribExpr () const |
Returns true if this node denotes an AttribExpr. | |
bool | denotesStmt () const |
Returns true if this node denotes a Stmt. | |
const char * | getKindString () const |
Returns a string matching the kind of this node. | |
virtual void | dump () |
Prints a representation of this ast node to stderr. | |
Static Public Member Functions | |
static bool | classof (const Ast *node) |
Support isa and dyn_cast. | |
Protected Member Functions | |
Ast (AstKind kind) | |
Protected Attributes | |
AstKind | kind: 8 |
The kind of this node. | |
bool | validFlag: 1 |
True if this node is valid. | |
bool | deletable: 1 |
True if we may call delete on this node. | |
unsigned | bits: 23 |
Unused bits available to sub-classes. | |
Static Protected Attributes | |
static const char * | kindStrings [LAST_AstKind] |
The root of the AST hierarchy.
The Ast class is the common root of all AST nodes in the system, but it is perhaps better to think of the immediate sub-classes of Ast as being the roots of forest of hierarchies. The main components, currently, are rooted by the Type and Decl nodes. The former begins a hierarchy of types, whereas the latter correspond to declarations and definitions.
Definition at line 148 of file AstBase.h.
enum comma::Ast::AstKind |
Codes which identify concrete members of the AST hierarchy.
Each concrete sub-class has an code which labels its identity. These codes are used, in the main, to implement the LLVM mechanisms for type identification and casting (llvm::isa, llvm::dyn_cast, etc).
Codes which do not begin with the prefix AST_ are considered to be internal to this enumeration (e.g. FIRST_Decl, LAST_Decl, etc). These codes should not be used directly and are subject to change. Instead, use the provided predicate methods such as Ast::denotesDecl, Ast::denotesType, etc.
NOTE: When adding/removing a member of this enumeration, be sure to update Ast::kindStrings as well.
comma::Ast::Ast | ( | AstKind | kind | ) | [inline, protected] |
static bool comma::Ast::classof | ( | const Ast * | node | ) | [inline, static] |
Support isa and dyn_cast.
Reimplemented in comma::Identifier, comma::ComponentKey, comma::AggregateExpr, comma::FunctionAttribDecl, comma::PosAD, comma::ValAD, comma::AttribExpr, comma::ScalarBoundAE, comma::FirstAE, comma::LastAE, comma::ArrayBoundAE, comma::FirstArrayAE, comma::LastArrayAE, comma::Decl, comma::ImportDecl, comma::ExceptionDecl, comma::ModelDecl, comma::Sigoid, comma::SignatureDecl, comma::VarietyDecl, comma::Domoid, comma::AddDecl, comma::DomainDecl, comma::FunctorDecl, comma::SigInstanceDecl, comma::ValueDecl, comma::ParamValueDecl, comma::ObjectDecl, comma::RenamedObjectDecl, comma::LoopDecl, comma::SubroutineDecl, comma::ProcedureDecl, comma::FunctionDecl, comma::EnumLiteral, comma::TypeDecl, comma::IncompleteTypeDecl, comma::CarrierDecl, comma::EnumerationDecl, comma::IntegerDecl, comma::ArrayDecl, comma::RecordDecl, comma::ComponentDecl, comma::AccessDecl, comma::DomainTypeDecl, comma::AbstractDomainDecl, comma::DomainInstanceDecl, comma::PercentDecl, comma::DSTDefinition, comma::ExceptionRef, comma::Expr, comma::DeclRefExpr, comma::FunctionCallExpr, comma::IndexedArrayExpr, comma::SelectedExpr, comma::InjExpr, comma::PrjExpr, comma::IntegerLiteral, comma::StringLiteral, comma::NullExpr, comma::QualifiedExpr, comma::DereferenceExpr, comma::ConversionExpr, comma::AllocatorExpr, comma::DiamondExpr, comma::KeywordSelector, comma::Range, comma::RangeAttrib, comma::ArrayRangeAttrib, comma::ScalarRangeAttrib, comma::Stmt, comma::StmtSequence, comma::HandlerStmt, comma::BlockStmt, comma::ProcedureCallStmt, comma::ReturnStmt, comma::AssignmentStmt, comma::IfStmt, comma::WhileStmt, comma::ForStmt, comma::LoopStmt, comma::PragmaStmt, comma::RaiseStmt, comma::NullStmt, comma::SubroutineRef, comma::Type, comma::SubroutineType, comma::FunctionType, comma::ProcedureType, comma::UniversalType, comma::PrimaryType, comma::IncompleteType, comma::DomainType, comma::DiscreteType, comma::EnumerationType, comma::IntegerType, comma::CompositeType, comma::ArrayType, comma::RecordType, comma::AccessType, and comma::TypeRef.
bool comma::Ast::denotesAttribExpr | ( | ) | const [inline] |
Returns true if this node denotes an AttribExpr.
bool comma::Ast::denotesCompositeType | ( | ) | const [inline] |
bool comma::Ast::denotesDecl | ( | ) | const [inline] |
bool comma::Ast::denotesDomainTypeDecl | ( | ) | const [inline] |
bool comma::Ast::denotesExpr | ( | ) | const [inline] |
Returns true if this node denotes a expression.
Reimplemented in comma::ComponentKey.
bool comma::Ast::denotesModelDecl | ( | ) | const [inline] |
bool comma::Ast::denotesPrimaryType | ( | ) | const [inline] |
Returns true if this node denotes a PrimaryType.
bool comma::Ast::denotesStmt | ( | ) | const [inline] |
bool comma::Ast::denotesSubroutineDecl | ( | ) | const [inline] |
bool comma::Ast::denotesSubroutineType | ( | ) | const [inline] |
bool comma::Ast::denotesType | ( | ) | const [inline] |
Returns true if this node denotes a Type.
Reimplemented in comma::ComponentKey.
bool comma::Ast::denotesTypeDecl | ( | ) | const [inline] |
bool comma::Ast::denotesValueDecl | ( | ) | const [inline] |
void Ast::dump | ( | ) | [virtual] |
AstKind comma::Ast::getKind | ( | ) | const [inline] |
const char* comma::Ast::getKindString | ( | ) | const [inline] |
virtual Location comma::Ast::getLocation | ( | ) | const [inline, virtual] |
Accesses the location of this node.
If no location information is available, or if this node was created internally by the compiler, an invalid location object (queriable by Location::isValid()) is returned.
Reimplemented in comma::Identifier, comma::ComponentKey, comma::Decl, comma::DSTDefinition, comma::ExceptionRef, comma::Expr, comma::FunctionCallExpr, comma::KeywordSelector, comma::RangeAttrib, comma::Stmt, comma::ProcedureCallStmt, comma::SubroutineRef, and comma::TypeRef.
bool comma::Ast::isDeletable | ( | ) | const [inline] |
bool comma::Ast::isValid | ( | ) | const [inline] |
void comma::Ast::markInvalid | ( | ) | [inline] |
unsigned comma::Ast::bits [protected] |
bool comma::Ast::deletable [protected] |
AstKind comma::Ast::kind [protected] |
const char * Ast::kindStrings [static, protected] |
bool comma::Ast::validFlag [protected] |