Skip to content

CPreproc::IfDirectiveExtractor

Traversal to extract '#if' directives.

Synopsis

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

class IfDirectiveExtractor
    : public ASTtools::PrePostTraversal

Base Classes

Name Description
ASTtools::PrePostTraversal

Member Functions

Name Description
IfDirectiveExtractor
IfDirectiveExtractor(Ifs_t& ifs); [constructor]
Construct from Ifs_t
visitBottomUp
virtual void visitBottomUp(SgNode* n); [virtual]
visitTopDown
virtual void visitTopDown(SgNode* n); [virtual]

Protected Member Functions

Name
getCurrentContext
If::Case const* getCurrentContext() const;

Private Member Functions

Name Description
addCase
void addCase( PreprocessingInfo* info, SgLocatedNode* node);
Adds the given directive/node to the current '#if' case.
handleCase
void handleCase( PreprocessingInfo* info, SgLocatedNode* node);
Updates the tree structure for a newly encountered 'info' directive.
newIf
void newIf( PreprocessingInfo* info, SgLocatedNode* node);
Creates a new '#if' directive.
validateNonEmptyStack
void validateNonEmptyStack( PreprocessingInfo const* info, SgLocatedNode const* node) const;
If the stack is empty, aborts with a message.
visit
void visit( SgNode* n, bool isTopDown);
Visits a node, either on the top-down or bottom-up visit.

Private Static Member Functions

Name Description
checkLastCaseNotEndif
static void checkLastCaseNotEndif(If const* i);
Asserts that we are not trying to add a case to a terminated '#if'.

Private Data Members

Name Description
ifs_ Collection of all top-level '#if' directives processed.
pending_ Stack of partially complete '#if' directives.

Derived Classes

Name Description
IfDirectiveContextFinder Find the '#if' case surrounding a given node.

Created with MrDocs