ROSE  0.11.96.11
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 26 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.
 
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)
 

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:
RoseAst
Interface for iterating over an AST.
Definition: RoseAst.h:26
RoseAst::iterator
AST iterator.
Definition: RoseAst.h:56
SgNode
This class represents the base class for all IR nodes within Sage III.
Definition: Cxx_Grammar.h:6739