ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SlicingInfo.h
Go to the documentation of this file.
1 #ifndef _SLICING_INFO_H_
2 #define _SLICING_INFO_H_
3 
4 #include <set>
5 #include <string>
6 #include <list>
7 /* ! \class SlicingInfo
8 
9  This class scans throught the AST for two different pragmas: First, a
10  pragma calls "SliceFunction" which indicates that the immediately
11  proceeding function is the function that the slicing algorithm should
12  target. Second, it finds the statement immediately proceeding the pragma
13  "SliceTarget" for use as the slicing criterion.
14 
15  Each of these pragmas are assumed to appear only once in the file.
16 
17  @todo Allow slicing criterion to be a set of statements rather than an
18  individual statement.
19 
20  */
21 
23 {
24 
25  public:
26 
27  SlicingInfo();
28  // manually add a node to the slicing set
29  void addNode(SgNode * sgNode)
30  {
31  targets.push_back(sgNode);
32  }
33  void setSliceTargetString(std::string target)
34  {
35  sliceStatement=target;
36  };
37 
38  // ! Returns the SgFunctionDeclaration that we are targeting
40  {
41  return _func;
42  };
43 
44  // ! Returns the statements that are part of the slicing criterion
46  {
47  return _target;
48  };
49 
50  std::list < SgNode * >getSlicingTargets()
51  {
52  return targets;
53  };
54 
55  protected:
56 
57  //std::list < SgStatement * >targets;
58  std::list < SgNode * >targets;
59  virtual void visit(SgNode * node);
60 
61  // ! The target function which is to be sliced.
63 
64  // ! The slicing criterion.
66 
67  /* ! \brief true when we need to mark the target function
68 
69  This is set to true when we see the pragma "SliceFunction." Once we
70  find the next function declaration, we assign it to _func and set this
71  to false again. */
73 
74  /* ! \brief true when we need to mark the slicing criterion
75 
76  This is set to true when we see the pragma "SliceTarget." Once we find
77  the next SgStatement, we assign it to _target and set this to false
78  again. */
80 
81 
82  // string for pragma to identify for slicing for functions calls of given function
83  std::string sliceFunctionCalls;
84  // string for pragma to slice for the following statement
85  std::string sliceStatement;
86 };
87 
88 
89 #endif