ROSE
0.9.6a
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
CreateSlice.h
Go to the documentation of this file.
1
#ifndef _CREATESLICE_H_
2
#define _CREATESLICE_H_
3
4
/* ! \class CreateSlice
5
6
This class is a traversal which marks elements that should be in a slice.
7
It does so by accepting a list of nodes that belong in the slice.
8
Currently, it's basically a destructive operation: the ast itself is
9
changed to produce the correct slice.
10
11
@todo The way that we create the slice is rather... simple. We completely
12
destroy any attendant file info by simply marking everything as compiler
13
generated and then marking the nodes of the slice as to be output. It may
14
be better in the future to create a second AST containing just the nodes of
15
the slice. */
16
// #include "rose.h"
17
#include <set>
18
19
class
BooleanSafeKeeper
20
{
21
public
:
22
BooleanSafeKeeper
():
boolean
(false){}
23
BooleanSafeKeeper
(
bool
boolVal):
boolean
(boolVal){};
24
bool
boolean
;
25
};
26
27
28
class
ROSE_DLL_API
CreateSlice
:
public
AstTopDownBottomUpProcessing
< BooleanSafeKeeper,BooleanSafeKeeper>
29
{
30
31
public
:
32
33
CreateSlice
(std::set < SgNode * >saveNodes):_toSave(saveNodes)
34
{
35
}
36
37
// bool traverse(SgNode * node) {return traverse(node, false);}
38
bool
traverse
(
SgNode
* node)
39
{
40
currentFile=NULL;
41
// return traverse(node,BooleanSafeKeeper(false));
42
return
AstTopDownBottomUpProcessing <BooleanSafeKeeper,BooleanSafeKeeper>::traverse
(node,
BooleanSafeKeeper
(
false
)).
boolean
;
43
}
44
protected
:
45
SgFile
*
currentFile
;
46
47
virtual
BooleanSafeKeeper
evaluateInheritedAttribute
(
SgNode
* node,
BooleanSafeKeeper
partOfSlice);
48
49
virtual
BooleanSafeKeeper
evaluateSynthesizedAttribute
(
SgNode
* node,
BooleanSafeKeeper
inherited,
50
SubTreeSynthesizedAttributes
atts);
51
BooleanSafeKeeper
defaultSynthesizedAttribute
(
BooleanSafeKeeper
inh)
52
{
53
// std::cout<<"DEFAULT SYNTHESIZED ATTRIBUTE CONSTRUCTOR CALLED\n";
54
return
inh;
55
}
56
std::stack<std::list<SgNode *> >
delayedRemoveListStack
;
57
/* virtual bool defaultSynthesizedAttribute()
58
{
59
return false;
60
}
61
virtual bool defaultInheritedAttribute()
62
{
63
return false;
64
} */
65
private
:
66
67
std::set < SgNode * >
_toSave
;
68
69
};
70
71
#endif
rose-edg4x
src
midend
programAnalysis
staticInterproceduralSlicing
CreateSlice.h
Generated on Mon May 5 2014 17:28:52 for ROSE by
1.8.4