ROSE  0.10.5.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
RoseAst Class Reference

Description

Interface for iterating over an AST.

The iterator follows the STL iterator pattern and is implemented as a depth-first, pre-order traversal that mtaintsins its own stack. The iterator performs the exact same traversal as the traversal classes in ROSE (it is using the same underlying information).

#include <RoseAst.h>
SgNode *node = .... // any subtree
RoseAst ast(node);
for (RoseAst::iterator i = ast.begin(); i != ast.end(); ++i)
std::cout <<"We are here: " <<(*i)->class_name() <<"\n";

Definition at line 28 of file RoseAst.h.

#include <RoseAst.h>

Classes

class  iterator
 AST iterator. More...
 

Public Types

typedef SgNode elementType
 
typedef elementTypepointer
 
typedef elementTypereference
 
typedef size_t size_type
 

Public Member Functions

 RoseAst (SgNode *astNode)
 Defines the starting node for traversal. More...
 
iterator begin ()
 Iterator positioned at root of subtree. More...
 
iterator end ()
 Iterator positioned at the end of the traversal. More...
 
SgFunctionDefinitionfindFunctionByName (std::string name)
 
std::list< SgFunctionDeclaration * > findFunctionDeclarationsByName (std::string name)
 
void setWithNullValues (bool flag)
 
void setWithTemplates (bool flag)
 

Static Public Member Functions

static bool isTemplateInstantiationNode (SgNode *node)
 determines whether a node is used to represent the root node of a template instantiation
 
static bool isTemplateNode (SgNode *node)
 determines whether a node is used to represent the root node of a template. More...
 
static bool isSubTypeOf (VariantT DerivedClassVariant, VariantT BaseClassVariant)
 determines based on VariantT whether a ROSE-AST node is a subtype of another node type. More...
 
static bool isSubType (VariantT DerivedClassVariant, VariantT BaseClassVariant)
 deprecated, use isSubTypeOf instead
 

Static Protected Member Functions

static SgNodeparent (SgNode *astNode)
 

Constructor & Destructor Documentation

RoseAst::RoseAst ( SgNode astNode)

Defines the starting node for traversal.

The traversal is over a subtree rooted at the specified root node. All operations are specific to this subtree, and the traversal does not iterate above this root.

Member Function Documentation

iterator RoseAst::begin ( )

Iterator positioned at root of subtree.

The returned iterator holds a pointer to the root node of the subtree to be traversed. The root node is specified in the constructor.

iterator RoseAst::end ( )

Iterator positioned at the end of the traversal.

The returned iterator is positioned one past the last node in the depth-first pre-order traversal.

static bool RoseAst::isTemplateNode ( SgNode node)
static

determines whether a node is used to represent the root node of a template.

static bool RoseAst::isSubTypeOf ( VariantT  DerivedClassVariant,
VariantT  BaseClassVariant 
)
static

determines based on VariantT whether a ROSE-AST node is a subtype of another node type.


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