comma::Ast Class Reference

The root of the AST hierarchy. More...

#include <AstBase.h>

Inheritance diagram for comma::Ast:
Inheritance graph
[legend]

List of all members.

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]

Detailed Description

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.


Member Enumeration Documentation

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.

Enumerator:
AST_SignatureDecl 

SignatureDecl.

AST_DomainDecl 

DomainDecl.

AST_VarietyDecl 

VarietyDecl.

AST_FunctorDecl 

FunctorDecl.

AST_AddDecl 

AddDecl.

AST_AccessDecl 

AccessDecl.

AST_CarrierDecl 

CarrierDecl.

AST_EnumerationDecl 

EnumerationDecl.

AST_IncompleteTypeDecl 

IncompleteTypeDecl.

AST_IntegerDecl 

IntegerDecl.

AST_ArrayDecl 

ArrayDecl.

AST_RecordDecl 

RecordDecl.

AST_AbstractDomainDecl 

AbstractDomainDecl.

AST_DomainInstanceDecl 

DomainInstanceDecl.

AST_PercentDecl 

PercentDecl.

AST_SigInstanceDecl 

SigInstanceDecl.

AST_LoopDecl 

LoopDecl.

AST_ObjectDecl 

ObjectDecl.

AST_ParamValueDecl 

ParamValueDecl.

AST_RenamedObjectDecl 

RenamedObjectDecl.

AST_ProcedureDecl 

ProcedureDecl.

AST_FunctionDecl 

FunctionDecl.

AST_EnumLiteral 

EnumLiteral.

AST_PosAD 

PosAD.

AST_ValAD 

ValAD.

AST_ImportDecl 

ImportDecl.

AST_ExceptionDecl 

ExceptionDecl.

AST_ComponentDecl 

ComponentDecl.

AST_UniversalType 

UniversalType.

AST_FunctionType 

FunctionType.

AST_ProcedureType 

ProcedureType.

AST_AccessType 

AccessType.

AST_ArrayType 

ArrayType.

AST_DomainType 

DomainType.

AST_EnumerationType 

EnumerationType.

AST_IncompleteType 

IncompleteType.

AST_IntegerType 

IntegerType.

AST_RecordType 

RecordType.

AST_AllocatorExpr 

AllocatorExpr.

AST_ConversionExpr 

ConversionExpr.

AST_DiamondExpr 

DiamondExpr.

AST_DeclRefExpr 

DeclRefExpr.

AST_DereferenceExpr 

DereferenceExpr.

AST_FunctionCallExpr 

FunctionCallExpr.

AST_IndexedArrayExpr 

IndexedArrayExpr.

AST_InjExpr 

InjExpr.

AST_IntegerLiteral 

IntegerLiteral.

AST_NullExpr 

NullExpr.

AST_AggregateExpr 

AggregateExpr.

AST_PrjExpr 

PrjExpr.

AST_QualifiedExpr 

QualifiedExpr.

AST_SelectedExpr 

SelectedExpr.

AST_StringLiteral 

StringLiteral.

AST_FirstAE 

FirstAE.

AST_FirstArrayAE 

FirstArrayAE.

AST_LastArrayAE 

LastArrayAE.

AST_LastAE 

LastAE.

AST_AssignmentStmt 

AssignmentStmt.

AST_BlockStmt 

BlockStmt.

AST_ForStmt 

ForStmt.

AST_HandlerStmt 

HandlerStmt.

AST_IfStmt 

IfStmt.

AST_LoopStmt 

LoopStmt.

AST_NullStmt 

NullStmt.

AST_ProcedureCallStmt 

ProcedureCallStmt.

AST_RaiseStmt 

RaiseStmt.

AST_ReturnStmt 

ReturnStmt.

AST_StmtSequence 

StmtSequence.

AST_WhileStmt 

WhileStmt.

AST_PragmaStmt 

PragmaStmt.

AST_KeywordSelector 

KeywordSelector.

AST_DSTDefinition 

DSTDefinition.

AST_Range 

Range.

AST_ArrayRangeAttrib 

ArrayRangeAttrib.

AST_ScalarRangeAttrib 

ScalarRangeAttrib.

AST_SubroutineRef 

SubroutineRef.

AST_TypeRef 

TypeRef.

AST_ExceptionRef 

ExceptionRef.

AST_Identifier 

Identifier.

AST_ComponentKey 

ComponentKey.

LAST_AstKind 
FIRST_Decl 
LAST_Decl 
FIRST_ModelDecl 
LAST_ModelDecl 
FIRST_TypeDecl 
LAST_TypeDecl 
FIRST_DomainType 
LAST_DomainType 
FIRST_ValueDecl 
LAST_ValueDecl 
FIRST_SubroutineDecl 
LAST_SubroutineDecl 
FIRST_Type 
LAST_Type 
FIRST_PrimaryType 
LAST_PrimaryType 
FIRST_Expr 
LAST_Expr 
FIRST_AttribExpr 
LAST_AttribExpr 
FIRST_Stmt 
LAST_Stmt 

Definition at line 165 of file AstBase.h.


Constructor & Destructor Documentation

virtual comma::Ast::~Ast (  )  [inline, virtual]

Definition at line 333 of file AstBase.h.

comma::Ast::Ast ( AstKind  kind  )  [inline, protected]

Initializes an Ast node of the specified kind.

Parameters:
kind The kind of node to create.

Definition at line 445 of file AstBase.h.


Member Function Documentation

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.

Definition at line 439 of file AstBase.h.

bool comma::Ast::denotesAttribExpr (  )  const [inline]

Returns true if this node denotes an AttribExpr.

Definition at line 423 of file AstBase.h.

bool comma::Ast::denotesCompositeType (  )  const [inline]

Returns true if this node denotes a composite type.

Definition at line 413 of file AstBase.h.

bool comma::Ast::denotesDecl (  )  const [inline]

Returns true if this node denotes a declaration.

Definition at line 365 of file AstBase.h.

bool comma::Ast::denotesDomainTypeDecl (  )  const [inline]

Returns true if this node denotes a domain type decl.

Definition at line 391 of file AstBase.h.

bool comma::Ast::denotesExpr (  )  const [inline]

Returns true if this node denotes a expression.

Reimplemented in comma::ComponentKey.

Definition at line 418 of file AstBase.h.

bool comma::Ast::denotesModelDecl (  )  const [inline]

Returns true if this node denotes a Model.

Definition at line 370 of file AstBase.h.

bool comma::Ast::denotesPrimaryType (  )  const [inline]

Returns true if this node denotes a PrimaryType.

Definition at line 401 of file AstBase.h.

bool comma::Ast::denotesStmt (  )  const [inline]

Returns true if this node denotes a Stmt.

Definition at line 428 of file AstBase.h.

bool comma::Ast::denotesSubroutineDecl (  )  const [inline]

Returns true if this node denotes a subroutine decl (i.e. either a procedure or function decl).

Definition at line 381 of file AstBase.h.

bool comma::Ast::denotesSubroutineType (  )  const [inline]

Returns true if this node denotes a subroutine type (i.e. either a procedure of function type).

Definition at line 407 of file AstBase.h.

bool comma::Ast::denotesType (  )  const [inline]

Returns true if this node denotes a Type.

Reimplemented in comma::ComponentKey.

Definition at line 396 of file AstBase.h.

bool comma::Ast::denotesTypeDecl (  )  const [inline]

Returns true if this node denotes a type declaration.

Definition at line 375 of file AstBase.h.

bool comma::Ast::denotesValueDecl (  )  const [inline]

Returns true if this node denotes a Value.

Definition at line 386 of file AstBase.h.

void Ast::dump (  )  [virtual]

Prints a representation of this ast node to stderr.

Definition at line 114 of file Ast.cpp.

AstKind comma::Ast::getKind (  )  const [inline]

Accesses the code identifying this node.

Definition at line 336 of file AstBase.h.

const char* comma::Ast::getKindString (  )  const [inline]

Returns a string matching the kind of this node.

Definition at line 433 of file AstBase.h.

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.

Definition at line 343 of file AstBase.h.

bool comma::Ast::isDeletable (  )  const [inline]

Returns true if one may call std::delete on this node.

Certain nodes are not deletable since they are allocated in special containers which perform memoization or manage memory in a special way.

Note:
This property is likely to disappear in the future.

Definition at line 362 of file AstBase.h.

bool comma::Ast::isValid (  )  const [inline]

Returns true if this node is valid.

The validity of a node does not have an inforced semantics. The Ast classes themselves never consult the validity bit. Nodes are marked invalid by a client of the Ast (for example, the type checker) and the meaning of such a mark is left for the client to decide.

Definition at line 351 of file AstBase.h.

void comma::Ast::markInvalid (  )  [inline]

Marks this node as invalid.

Definition at line 354 of file AstBase.h.


Member Data Documentation

unsigned comma::Ast::bits [protected]

Unused bits available to sub-classes.

Definition at line 454 of file AstBase.h.

bool comma::Ast::deletable [protected]

True if we may call delete on this node.

Definition at line 453 of file AstBase.h.

The kind of this node.

Definition at line 451 of file AstBase.h.

const char * Ast::kindStrings [static, protected]

Definition at line 456 of file AstBase.h.

bool comma::Ast::validFlag [protected]

True if this node is valid.

Definition at line 452 of file AstBase.h.


The documentation for this class was generated from the following files:

Generated on 1 Feb 2010 for Comma by  doxygen 1.6.1