ROSE 0.11.145.192
|
Attribute Evaluator for inherited and synthesized attributes.
In general, this class combines the classes TopDownProcessing and BottomUpProcessing and also allows to use the inherited attribute of a node in the computation of the synthesized attribute at the same node.
This class allows to compute inherited and synthesized attributes on the AST. It requires an inherited attribute type and a synthesized attribute type as a template parameter and the implementation of the function evaluateInheritedAttribute and evaluateSynthesizedAttribute. The function evaluateInheritedAttribute is invoked in pre-order, the function evaluateSynthesizedAttribute is invoked in post-order while the AST is traversed. The function evaluateSynthesizedAttribute gets as additional parameter the inheritedAttribute value which is computed at the respective node. It can be used to make the computation of the synthesized attribute at a node dependent on the value of the inherited attribute of the same node.
Definition at line 184 of file AstProcessing.h.
#include <AstProcessing.h>
Public Types | |
typedef SgTreeTraversal< InheritedAttributeType, SynthesizedAttributeType >::SynthesizedAttributesList | SynthesizedAttributesList |
typedef SynthesizedAttributesList | SubTreeSynthesizedAttributes |
Public Types inherited from SgTreeTraversal< InheritedAttributeType, SynthesizedAttributeType > | |
typedef StackFrameVector< SynthesizedAttributeType > | SynthesizedAttributesList |
Public Member Functions | |
SynthesizedAttributeType | traverse (SgNode *node, InheritedAttributeType inheritedValue) |
evaluates attributes on the entire AST | |
SynthesizedAttributeType | traverseWithinFile (SgNode *node, InheritedAttributeType inheritedValue) |
evaluates attributes only at nodes which represent the same file as where the evaluation was started | |
Public Member Functions inherited from SgTreeTraversal< InheritedAttributeType, SynthesizedAttributeType > | |
SynthesizedAttributeType | traverse (SgNode *basenode, InheritedAttributeType inheritedValue, t_traverseOrder travOrder=preandpostorder) |
SynthesizedAttributeType | traverseWithinFile (SgNode *basenode, InheritedAttributeType inheritedValue, t_traverseOrder travOrder=preandpostorder) |
void | traverseInputFiles (SgProject *projectNode, InheritedAttributeType inheritedValue, t_traverseOrder travOrder=preandpostorder) |
SgTreeTraversal (const SgTreeTraversal &) | |
const SgTreeTraversal & | operator= (const SgTreeTraversal &) |
Protected Member Functions | |
virtual InheritedAttributeType | evaluateInheritedAttribute (SgNode *astNode, InheritedAttributeType inheritedValue)=0 |
pure virtual function which must be implemented to compute the inherited attribute at a node | |
virtual SynthesizedAttributeType | evaluateSynthesizedAttribute (SgNode *, InheritedAttributeType, SynthesizedAttributesList)=0 |
pure virtual function which must be implemented to compute the synthesized attribute at a node. | |
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. | |
virtual void | atTraversalEnd () |
Protected Member Functions inherited from SgTreeTraversal< InheritedAttributeType, SynthesizedAttributeType > | |
virtual void | setNodeSuccessors (SgNode *node, SuccessorsContainer &succContainer) |
virtual SynthesizedAttributeType | defaultSynthesizedAttribute (InheritedAttributeType inh) |
void | set_useDefaultIndexBasedTraversal (bool) |
Additional Inherited Members | |
Protected Types inherited from SgTreeTraversal< InheritedAttributeType, SynthesizedAttributeType > | |
typedef AstSuccessorsSelectors::SuccessorsContainer | SuccessorsContainer |
typedef SuccessorsContainer & | SuccessorsContainerRef |
typedef SgTreeTraversal<InheritedAttributeType,SynthesizedAttributeType>::SynthesizedAttributesList AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::SynthesizedAttributesList |
Definition at line 189 of file AstProcessing.h.
typedef SynthesizedAttributesList AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::SubTreeSynthesizedAttributes |
Definition at line 192 of file AstProcessing.h.
SynthesizedAttributeType AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::traverse | ( | SgNode * | node, |
InheritedAttributeType | inheritedValue | ||
) |
evaluates attributes on the entire AST
Definition at line 486 of file AstProcessing.h.
SynthesizedAttributeType AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::traverseWithinFile | ( | SgNode * | node, |
InheritedAttributeType | inheritedValue | ||
) |
evaluates attributes only at nodes which represent the same file as where the evaluation was started
Definition at line 498 of file AstProcessing.h.
|
protectedpure virtual |
pure virtual function which must be implemented to compute the inherited attribute at a node
Implements SgTreeTraversal< InheritedAttributeType, SynthesizedAttributeType >.
Implemented in FunctionEvaluationOrderTraversal, AstCombinedTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >, and AstSharedMemoryParallelizableTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >.
|
protectedpure virtual |
pure virtual function which must be implemented to compute the synthesized attribute at a node.
The list of synthesized attributes consists of the synthesized attributes computed at the children node of the current node. The inherited attribute value is computed by evaluateInheritedAttribute at the same node and simply passed to this function. Use the typedef SynthesizedAttributeList as type for the synthesized attributes list.
Implements SgTreeTraversal< InheritedAttributeType, SynthesizedAttributeType >.
Implemented in FunctionEvaluationOrderTraversal, and AstCombinedTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >.
|
protectedvirtual |
Function called at the start of the traversal, before any node is visited; override if necessary, the default implementation is a no-op.
Reimplemented from SgTreeTraversal< InheritedAttributeType, SynthesizedAttributeType >.
Reimplemented in AstCombinedTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >.
Definition at line 923 of file AstProcessing.h.
|
protectedvirtual |
Reimplemented from SgTreeTraversal< InheritedAttributeType, SynthesizedAttributeType >.
Definition at line 930 of file AstProcessing.h.