ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MarkingNodes Class Reference

#include <MarkingNodes.h>

Inheritance diagram for MarkingNodes:
Collaboration diagram for MarkingNodes:

Public Member Functions

void initialize (set< SgNode * > s, SgFunctionDefinition *func)
 
set< SgNode * > get_newStatementList ()
 
list< SgFunctionDeclaration * > get_funclist ()
 
- Public Member Functions inherited from AstTopDownBottomUpProcessing< bool, bool >
bool traverse (SgNode *node, boolinheritedValue)
 evaluates attributes on the entire AST More...
 
bool traverseWithinFile (SgNode *node, boolinheritedValue)
 evaluates attributes only at nodes which represent the same file as where the evaluation was started More...
 
- Public Member Functions inherited from SgTreeTraversal< bool, bool >
bool traverse (SgNode *basenode, boolinheritedValue, t_traverseOrder travOrder=preandpostorder)
 
bool traverseWithinFile (SgNode *basenode, boolinheritedValue, t_traverseOrder travOrder=preandpostorder)
 
void traverseInputFiles (SgProject *projectNode, boolinheritedValue, t_traverseOrder travOrder=preandpostorder)
 
virtual ~SgTreeTraversal ()
 
 SgTreeTraversal ()
 
 SgTreeTraversal (const SgTreeTraversal &)
 
const SgTreeTraversaloperator= (const SgTreeTraversal &)
 

Static Public Member Functions

static void checkIfDeclared (SgNode *node, bool keep)
 

Protected Member Functions

void keepAllNodes (SgNode *node)
 
void insertInList (SgNode *node)
 
bool isAlreadyInSet (SgNode *node)
 
virtual bool evaluateInheritedAttribute (SgNode *astNode, bool inherited)
 
virtual bool evaluateSynthesizedAttribute (SgNode *astNode, bool inherited, vector< bool > synattri)
 
bool defaultSynthesizedAttribute ()
 
- Protected Member Functions inherited from AstTopDownBottomUpProcessing< bool, bool >
virtual bool evaluateSynthesizedAttribute (SgNode *, bool, SynthesizedAttributesList)=0
 pure virtual function which must be implemented to compute the synthesized attribute at a node. More...
 
virtual void atTraversalStart ()
 Function called at the start of the traversal, before any node is visited; override if necessary, the default implementation is a no-op. More...
 
virtual void atTraversalEnd ()
 
- Protected Member Functions inherited from SgTreeTraversal< bool, bool >
virtual void setNodeSuccessors (SgNode *node, SuccessorsContainer &succContainer)
 
virtual bool defaultSynthesizedAttribute (boolinh)
 
void set_useDefaultIndexBasedTraversal (bool)
 

Static Protected Member Functions

static void keepNode (SgNode *node)
 

Protected Attributes

set< SgNode * > stmtlist
 
set< SgNode * > newStmtlist
 The input list of statements that we are to have in our slice. More...
 
set< SgNode * > allreturnedstmts
 Output list of statements that need to be included. More...
 
SgFunctionDefinitionsliceThisFunc
 
list< SgFunctionDeclaration * > funclist
 
bool beforePragma
 

Additional Inherited Members

- Public Types inherited from AstTopDownBottomUpProcessing< bool, bool >
typedef SgTreeTraversal< bool,
bool >
::SynthesizedAttributesList 
SynthesizedAttributesList
 
typedef SynthesizedAttributesList SubTreeSynthesizedAttributes
 
- Protected Types inherited from SgTreeTraversal< bool, bool >
typedef
AstSuccessorsSelectors::SuccessorsContainer 
SuccessorsContainer
 
typedef SuccessorsContainerSuccessorsContainerRef
 

Detailed Description

MarkingNodes is a subclass of AstTopDownBottomUpProcessing. In this traversal AST nodes are marked according to if the are to be or not to be in the slice: Each AST node is compared to the with the list of statements that are to be in the slice. If an AST node is found in the list of statements, then the subtree with this node as its root is marked with the attribute keep=true, and also a synthesized attribute is "sent" up in the tree, such that we mark all nodes "above" the current node with the attribute keep=true.

Definition at line 36 of file MarkingNodes.h.

Member Function Documentation

void MarkingNodes::keepAllNodes ( SgNode node)
protected

This function marks all nodes in the subtree with node as the root to be kept.

static void MarkingNodes::keepNode ( SgNode node)
staticprotected

This function adds the AstAttribute keep to the node and sets the value of the attribute to be true.

void MarkingNodes::insertInList ( SgNode node)
protected

This function inserts the node in the list which we return in get_newStatementList().

bool MarkingNodes::isAlreadyInSet ( SgNode node)
protected

This function checks if the node is already in two sets: 1) the set of statements returning from the current travesal 2) the set of all statements ever returned from a traversal. The latter set is to avoid to include a statement that is already known to be kept, and thus avoid never-ending loops in the function FindStatementsForSlice().

Parameters
node- the node which is to be tested if it is in the set of new statements we are finding from the control structures and if it is in the set of all statements found for the slice ever found.
Returns
Returns true if is already in any of the sets, otherwise false is retured.
void MarkingNodes::initialize ( set< SgNode * >  s,
SgFunctionDefinition func 
)

This function sets the statement list. It also clears the list containing the "new"(i.e. the statements we collect in this traversal) statements, as well as the bool beforePragma to be true as a default.

set<SgNode*> MarkingNodes::get_newStatementList ( )
inline

This function returns the list of new statements for which we need to find all statements that affect them.

Definition at line 91 of file MarkingNodes.h.

References newStmtlist.

list<SgFunctionDeclaration*> MarkingNodes::get_funclist ( )
inline

This function returns the list of function declarations which are to be in the slice. (Not complete from this marking traversal. We also need to find possible function calls within these functions recursively.)

Definition at line 97 of file MarkingNodes.h.

References funclist.

static void MarkingNodes::checkIfDeclared ( SgNode node,
bool  keep 
)
static

If the boolean keep is true, then this function checks that the SgNode node is declared/defined properly. This means the functions checks if the definition AST node of the variable which occurs at node has the AstAttribute "keep".

If the boolean value keep is false, this SgNode is not to be included in the slice and thus does not need to be defined/declared properly.

Parameters
node- the node that is to be checked if is declared properly.
keep- a boolean value that tells us whether this check is necessary or not.
virtual bool MarkingNodes::evaluateInheritedAttribute ( SgNode astNode,
bool  inherited 
)
protectedvirtual

This function implements the virtual function "evaluateInheritedAttribute" in the class AstTopDownBottomUpProcessing. In this function marking of statements which are to be kept for the slice is done. (more specific?)

Implements AstTopDownBottomUpProcessing< bool, bool >.

virtual bool MarkingNodes::evaluateSynthesizedAttribute ( SgNode astNode,
bool  inherited,
vector< bool >  synattri 
)
protectedvirtual

This function implements the virtual function "evaluateSynthesizedAttribute" in the class AstTopDownBottomUpProcessing.

bool MarkingNodes::defaultSynthesizedAttribute ( )
protected

This function implements the virtual function "defaultSynthesizedAttribute" in the class AstTopDownBottomUpProcessing. The default return value is "false", implying that the default answer to whether an AST node is to be kept for the slice or not, is not to keep.

Member Data Documentation

set<SgNode*> MarkingNodes::stmtlist
protected

Definition at line 40 of file MarkingNodes.h.

set<SgNode*> MarkingNodes::newStmtlist
protected

The input list of statements that we are to have in our slice.

Definition at line 41 of file MarkingNodes.h.

Referenced by get_newStatementList().

set<SgNode*> MarkingNodes::allreturnedstmts
protected

Output list of statements that need to be included.

Definition at line 42 of file MarkingNodes.h.

SgFunctionDefinition* MarkingNodes::sliceThisFunc
protected

Definition at line 43 of file MarkingNodes.h.

list<SgFunctionDeclaration*> MarkingNodes::funclist
protected

Definition at line 44 of file MarkingNodes.h.

Referenced by get_funclist().

bool MarkingNodes::beforePragma
protected

A variable that tells us if we are before the first pragma declaration in the code.

Definition at line 77 of file MarkingNodes.h.


The documentation for this class was generated from the following file: