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


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>


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)

Static Public Member Functions

static bool isSubType (VariantT DerivedClassVariant, VariantT BaseClassVariant)

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.

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