ROSE 0.11.145.192
AstTraversal.h
1// Author: Markus Schordan
2// $Id: AstTraversal.h,v 1.3 2006/04/24 00:21:32 dquinlan Exp $
3
4#ifndef ASTTRAVERSAL_H
5#define ASTTRAVERSAL_H
6
7
8#include "TreeTraversal.h"
9//#include "sage3.h"
10
11// WORK IN PROGRESS. DO NOT MODIFY OR THINK ABOUT IT.
12
13// test new traversal classes
14// example class for tree traversal
15class AstPreOrderTraversal : public PreOrderTraversal<SgNode*> {
16protected:
17 virtual void preOrderVisit(SgNode* node);
18 virtual void setChildrenContainer(SgNode* node, std::vector<SgNode*>& c);
19};
20
21class AstPrePostOrderTraversal : public PrePostOrderTraversal<SgNode*> {
22protected:
23 virtual void setChildrenContainer(SgNode* node, std::vector<SgNode*>& c);
24};
25
36public:
39 std::list<SgNode*> determineCycle(std::list<SgNode*>& l, SgNode* node);
40 std::list<SgNode*> activeNodes;
41 virtual void preOrderVisit(SgNode* node);
42
45 virtual void setChildrenContainer(SgNode* node, std::vector<SgNode*>& c);
46 virtual void postOrderVisit(SgNode* node);
47 virtual void modifyChildrenContainer(SgNode*, std::vector<SgNode*>&) {}
48};
49
50#endif
51
AstCycleTest is based on the successor information of SgNodes (the same information that is used by t...
std::list< SgNode * > determineCycle(std::list< SgNode * > &l, SgNode *node)
determines whether the given sequence l of nodes extended by node creates a cycle the found cycle is ...
virtual void setChildrenContainer(SgNode *node, std::vector< SgNode * > &c)
In case of a cycle the traversal does not continue to prevent an infinite recursion of the traversal.
This class represents the base class for all IR nodes within Sage III.