Skip to content

CPreproc::IfDirectiveContextFinder

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

Synopsis

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

Base Classes

Name

Description

IfDirectiveExtractor

Traversal to extract '#if' directives.

Member Functions

Name

Description

IfDirectiveContextFinder [constructor]

Constructor

getContextBottom

getContextTop

visitBottomUp [virtual]

visitTopDown [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.

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.

Created with MrDocs