Skip to content

RoseAst

Interface for iterating over an AST.

Synopsis

Declared in <src/midend/abstractLayer/RoseAst.h>

class RoseAst;

Types

Name

Description

iterator

AST iterator.

elementType

pointer

reference

size_type

Member Functions

Name

Description

RoseAst [constructor]

Defines the starting node for traversal.

begin

Iterator positioned at root of subtree.

end

Iterator positioned at the end of the traversal.

findFunctionByName

findFunctionDeclarationsByName

setWithNullValues

setWithTemplates

Static Member Functions

Name

Description

isSubType

deprecated, use isSubTypeOf instead

isSubTypeOf

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

isTemplateInstantiationNode

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

isTemplateNode

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

Protected Static Member Functions

Name

parent

Private Data Members

Description

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";

Created with MrDocs