1#ifndef ROSE_AST_Traversal_H 
    2#define ROSE_AST_Traversal_H 
   44template<
class T, 
class Functor>
 
   51    void operator()(
SgNode *node, 
const Order order)
 const override {
 
   52        if (T *typedNode = 
dynamic_cast<T*
>(node))
 
 
   58template<
class T, 
class Functor>
 
   65    void operator()(
SgNode *node, 
const Order order)
 const override {
 
   67            if (T *typedNode = 
dynamic_cast<T*
>(node))
 
 
   74template<
class T, 
class Functor>
 
   81    void operator()(
SgNode *node, 
const Order order)
 const override {
 
   83            if (T *typedNode = 
dynamic_cast<T*
>(node))
 
 
  100    virtual bool operator()(
SgNode *node) = 0;
 
 
  104template<
class T, 
class Functor>
 
  108    explicit Finder(Functor &f)
 
  111    bool operator()(
SgNode *node)
 override {
 
  112        if (T *typedNode = 
dynamic_cast<T*
>(node)) {
 
 
  182template<
class T, 
class Functor>
 
  192template<
class T, 
class Functor>
 
  202template<
class T, 
class Functor>
 
  213template<
class T, 
class Functor>
 
  222template<
class T, 
class Functor>
 
  231template<
class T, 
class Functor>
 
  242template<
class T, 
class Functor>
 
  246    detail::findReverseHelper(ast, finder );
 
  247    return dynamic_cast<T*
>(finder.found);
 
 
  257    auto yes = [](
SgNode*) { 
return true; };
 
  259    detail::findReverseHelper(ast, finder );
 
  260    return dynamic_cast<T*
>(finder.found);
 
 
  270    std::vector<T*> retval;
 
  271    forwardPre<T>(ast, [&retval](T *node) {
 
  272        retval.push_back(node);
 
 
 
This class represents the base class for all IR nodes within Sage III.
 
void forward(SgNode *ast, Functor functor)
Traverse an AST in a forward direction.
 
std::vector< T * > findDescendantsTyped(SgNode *ast)
Find all descendants of specified type.
 
T * findParentTyped(SgNode *ast)
Find the closest parent of specified type.
 
void reversePost(SgNode *ast, Functor functor)
Traverse an AST in the reverse with post-visit only.
 
void forwardPost(SgNode *ast, Functor functor)
Traverse an AST in a forward direction with post-visit only.
 
Order
Order that visitor is called for node w.r.t.
 
@ POST
Visitor is called after visiting the node's children.
 
@ PRE
Visitor is called before visiting the node's children.
 
void forwardPre(SgNode *ast, Functor functor)
Traverse an AST in a forward direction with pre-visit only.
 
T * findParentSatisying(SgNode *ast, Functor functor)
Reverse traversal that finds the first node satisfying the predicate.
 
void reverse(SgNode *ast, Functor functor)
Traverse an AST in the reverse direction.
 
void reversePre(SgNode *ast, Functor functor)
Traverse an AST in the reverse with pre-visit only.