ROSE 0.11.145.147
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";
AST iterator.
Definition RoseAst.h:54
Interface for iterating over an AST.
Definition RoseAst.h:26
This class represents the base class for all IR nodes within Sage III.

Definition at line 26 of file RoseAst.h.

#include <midend/astMatching/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.
 
iterator begin ()
 Iterator positioned at root of subtree.
 
iterator end ()
 Iterator positioned at the end of the traversal.
 
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.
 
static bool isSubTypeOf (VariantT DerivedClassVariant, VariantT BaseClassVariant)
 determines based on VariantT whether a ROSE-AST node is a subtype of another node type.
 
static bool isSubType (VariantT DerivedClassVariant, VariantT BaseClassVariant)
 deprecated, use isSubTypeOf instead
 

Static Protected Member Functions

static SgNodeparent (SgNode *astNode)
 

Member Typedef Documentation

◆ elementType

Definition at line 28 of file RoseAst.h.

◆ pointer

Definition at line 29 of file RoseAst.h.

◆ reference

Definition at line 30 of file RoseAst.h.

◆ size_type

typedef size_t RoseAst::size_type

Definition at line 31 of file RoseAst.h.

Constructor & Destructor Documentation

◆ RoseAst()

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

◆ begin()

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.

◆ end()

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.


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