ROSE 0.11.145.147
Public Types | Public Member Functions | Protected Member Functions | List of all members
AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType > Class Template Referenceabstract

Description

template<class InheritedAttributeType, class SynthesizedAttributeType>
class AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >

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>

Inheritance diagram for AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >:
Inheritance graph
[legend]
Collaboration diagram for AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >:
Collaboration graph
[legend]

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 SgTreeTraversaloperator= (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
 

Member Typedef Documentation

◆ SynthesizedAttributesList

template<class InheritedAttributeType , class SynthesizedAttributeType >
typedef SgTreeTraversal<InheritedAttributeType,SynthesizedAttributeType>::SynthesizedAttributesList AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::SynthesizedAttributesList

Definition at line 189 of file AstProcessing.h.

◆ SubTreeSynthesizedAttributes

template<class InheritedAttributeType , class SynthesizedAttributeType >
typedef SynthesizedAttributesList AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::SubTreeSynthesizedAttributes

Definition at line 192 of file AstProcessing.h.

Member Function Documentation

◆ traverse()

template<class InheritedAttributeType , class SynthesizedAttributeType >
SynthesizedAttributeType AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::traverse ( SgNode node,
InheritedAttributeType  inheritedValue 
)

evaluates attributes on the entire AST

Definition at line 486 of file AstProcessing.h.

◆ traverseWithinFile()

template<class InheritedAttributeType , class SynthesizedAttributeType >
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.

◆ evaluateInheritedAttribute()

template<class InheritedAttributeType , class SynthesizedAttributeType >
virtual InheritedAttributeType AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::evaluateInheritedAttribute ( SgNode astNode,
InheritedAttributeType  inheritedValue 
)
protectedpure virtual

◆ evaluateSynthesizedAttribute()

template<class InheritedAttributeType , class SynthesizedAttributeType >
virtual SynthesizedAttributeType AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::evaluateSynthesizedAttribute ( SgNode ,
InheritedAttributeType  ,
SynthesizedAttributesList   
)
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 >.

◆ atTraversalStart()

template<class InheritedAttributeType , class SynthesizedAttributeType >
void AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::atTraversalStart ( )
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.

◆ atTraversalEnd()

template<class InheritedAttributeType , class SynthesizedAttributeType >
void AstTopDownBottomUpProcessing< InheritedAttributeType, SynthesizedAttributeType >::atTraversalEnd ( )
protectedvirtual

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