Skip to content

CPreproc::IfDirectiveContextFinder

Find the '#if' case surrounding a given node.

Synopsis

Declared in <src/midend/programTransformation/astOutlining/IfDirectiveContextFinder.hh>

class IfDirectiveContextFinder
    : public IfDirectiveExtractor

Description

Given a target node, this traversal extracts the full program's '#if' directive structure and determines which '#if' case surrounds the top and bottom portion of the target node.

For example, suppose a target SgBasicBlock is situated in the source code as follows:

// ... #elif CONDITION_1 // ... { // ... #elif CONDITION_2 // ... } // ...

Then, this traversal permits the caller to determine that '#elif CONDITION_1' guards the top of the block, and '#elif CONDITION_2' guards the bottom of the block.

Base Classes

Name Description
IfDirectiveExtractor Traversal to extract '#if' directives.

Member Functions

Name Description
IfDirectiveContextFinder
IfDirectiveContextFinder( CPreproc::Ifs_t& ifs, SgLocatedNode const* target); [constructor]
Constructor
getContextBottom
If::Case* getContextBottom();
getContextTop
If::Case* getContextTop();
visitBottomUp
virtual void visitBottomUp(SgNode* n); [virtual]
visitTopDown
virtual void visitTopDown(SgNode* n); [virtual]

Private Data Members

Name Description
bottom_ Stores the context at the bottom of the target node.
target_ Node for which context is being sought.
top_ Stores the context at the top of the target node.

Created with MrDocs