ROSE 0.11.145.192
Public Member Functions | Public Attributes | List of all members
AstCycleTest Class Reference

Description

AstCycleTest is based on the successor information of SgNodes (the same information that is used by the traversals).

It tests such that it allows a preorder traversal to revisit nodes but reports an error if the traversal would run into a cycle. If a cycle is found it reports the list of SgNodes that are part of the cycle to stdout, starting with "CYCLE FOUND: ..." and stops testing. Usage: AstCycleTest t; t.traverse(SgNode* n); // where n is the root node of the subtree to be tested.

Definition at line 35 of file AstTraversal.h.

#include <midend/astProcessing/AstTraversal.h>

Inheritance diagram for AstCycleTest:
Inheritance graph
[legend]
Collaboration diagram for AstCycleTest:
Collaboration graph
[legend]

Public Member Functions

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 returned.
 
virtual void preOrderVisit (SgNode *node)
 
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.
 
virtual void postOrderVisit (SgNode *node)
 
virtual void modifyChildrenContainer (SgNode *, std::vector< SgNode * > &)
 

Public Attributes

std::list< SgNode * > activeNodes
 

Additional Inherited Members

Member Function Documentation

◆ determineCycle()

std::list< SgNode * > AstCycleTest::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 returned.

If no cycle is found, the returned list is empty.

◆ setChildrenContainer()

virtual void AstCycleTest::setChildrenContainer ( SgNode node,
std::vector< SgNode * > &  c 
)
virtual

In case of a cycle the traversal does not continue to prevent an infinite recursion of the traversal.

Reimplemented from AstPrePostOrderTraversal.

◆ modifyChildrenContainer()

virtual void AstCycleTest::modifyChildrenContainer ( SgNode ,
std::vector< SgNode * > &   
)
inlinevirtual

Definition at line 47 of file AstTraversal.h.

Member Data Documentation

◆ activeNodes

std::list<SgNode*> AstCycleTest::activeNodes

Definition at line 40 of file AstTraversal.h.


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