Class IfDirectiveContextFinder#

Inheritance Relationships#

Base Type#

Class Documentation#

class IfDirectiveContextFinder : public CPreproc::IfDirectiveExtractor#

Find the ‘#if’ case surrounding a given node.

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.

Get context.

If::Case *getContextTop(void)#
const If::Case *getContextTop(void) const#
If::Case *getContextBottom(void)#
const If::Case *getContextBottom(void) const#

Public Functions

IfDirectiveContextFinder(CPreproc::Ifs_t &ifs, const SgLocatedNode *target)#
virtual void visitTopDown(SgNode *n)#

Called as we descend the tree.

virtual void visitBottomUp(SgNode *n)#

Called as we ascend the tree.