ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MarkingNodes.h
Go to the documentation of this file.
1 
2 #include <set>
3 
4 #include "KeepAttribute.h"
5 
6 #ifndef MARKALL_IS_DEFINED
7 #define MARKALL_IS_DEFINED
8 
12 //#include "MarkingNodes.h"
14  public:
15  virtual void visit(SgNode* astNode){
16  if(!astNode->attribute.exists("keep")){
17  astNode->attribute.add("keep", new KeepAttribute(true));
18  }
19  // MarkingNodes::keepNode(astNode); // would be nicer to reuse this func
20  }
21 };
22 #endif
23 
24 #ifndef MARKINGNODES_IS_DEFINED
25 #define MARKINGNODES_IS_DEFINED
26 
36 class MarkingNodes : public AstTopDownBottomUpProcessing<bool, bool> {
37 
38  // private:
39  protected:
40  set<SgNode*> stmtlist;
41  set<SgNode*> newStmtlist;
42  set<SgNode*> allreturnedstmts;
44  list<SgFunctionDeclaration*> funclist;
45 
46  protected:
50  void keepAllNodes(SgNode* node);
51 
55  static void keepNode(SgNode* node);
56 
57 
61  void insertInList(SgNode* node);
62 
74  bool isAlreadyInSet(SgNode* node);
75 
78 
79  public:
85  void initialize(set<SgNode*> s, SgFunctionDefinition* func);
86 
91  set<SgNode*> get_newStatementList(){return newStmtlist;}
92 
97  list<SgFunctionDeclaration*> get_funclist(){return funclist;}
98 
99 
111  static void checkIfDeclared(SgNode* node, bool keep);
112 
113 
114 
115  protected:
119  bool virtual evaluateInheritedAttribute(SgNode* astNode, bool inherited);
120 
124  bool virtual evaluateSynthesizedAttribute(SgNode* astNode,
125  bool inherited, vector<bool> synattri);
126 
131 
132 };
133 
134 #endif
135