ROSE 0.11.145.192
|
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 <midend/astMatching/RoseAst.h>
Classes | |
class | iterator |
AST iterator. More... | |
Public Types | |
typedef SgNode | elementType |
typedef elementType * | pointer |
typedef elementType & | reference |
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. | |
SgFunctionDefinition * | findFunctionByName (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 SgNode * | parent (SgNode *astNode) |
typedef SgNode RoseAst::elementType |
typedef elementType* RoseAst::pointer |
typedef elementType& RoseAst::reference |
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
.
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.
Referenced by SageInterface::checkTypesAreEqual(), SageInterface::collectReadOnlyVariables(), SageInterface::eraseNullPreprocessingInfo(), SageBuilder::fixupCopyOfAstFromSeparateFileInNewTargetAst(), SageInterface::isStructurallyEquivalentAST(), SageInterface::markSubtreeToBeUnparsed(), SageInterface::moveUpInnerDanglingIfEndifDirective(), and SageInterface::wrapAllTemplateInstantiationsInAssociatedNamespaces().
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.
Referenced by SageInterface::checkTypesAreEqual(), SageInterface::collectReadOnlyVariables(), SageInterface::eraseNullPreprocessingInfo(), SageBuilder::fixupCopyOfAstFromSeparateFileInNewTargetAst(), SageInterface::isStructurallyEquivalentAST(), SageInterface::markSubtreeToBeUnparsed(), SageInterface::moveUpInnerDanglingIfEndifDirective(), and SageInterface::wrapAllTemplateInstantiationsInAssociatedNamespaces().