Skip to content

CPreproc::If::Case

Stores one case of a preprocessor '#if' directive.

Synopsis

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

class Case;

Description

A If::Case object stores a particular case, identified through a (PreprocessingInfo, SgLocatedNode) pair. It also stores pointers to child If objects, representing nested '#if' directives.

Type Aliases

Name
const_iterator
const_reverse_iterator
iterator
reverse_iterator

Member Functions

Name Description
Case
Case(Case const& other); [constructor]
Constructors
~Case
~Case(); [destructor]
Destructor
appendChild
void appendChild(If*);
Makes the given '#if' a child of this case.
begin
iterator begin();
dump
void dump(size_t level = 0);
end
iterator end();
getCondition
std::string getCondition() const;
Get the condition represented by this case.
getDirective
std::string getDirective() const;
Returns the directive as a string (i.e., '#if').
getIf
If* getIf();
getInfo
PreprocessingInfo* getInfo();
getNode
SgLocatedNode* getNode();
getRaw
std::string getRaw() const;
Returns the complete, raw directive, as a string.
isElif
bool isElif() const;
Returns 'true' if this case is an '#elif'.
isElse
bool isElse() const;
Returns 'true' if this case is an '#else'.
isEndif
bool isEndif() const;
Returns 'true' if this case is an '#endif'.
isIf
bool isIf() const;
Returns 'true' if this case is a '#if'.
isIfdef
bool isIfdef() const;
Returns 'true' if this case is a '#ifdef'.
isIfndef
bool isIfndef() const;
Returns 'true' if this case is a '#ifndef'.
rbegin
reverse_iterator rbegin();
rend
reverse_iterator rend();
setIf
void setIf(If*);
Associates this case with a particular directive.

Protected Member Functions

Name Description
Case
Case(); [constructor]
The default constructor, hidden to prevent users from instantiating a case without specifying the actual directive (PreprocessingInfo object and AST node).

Private Data Members

Name Description
info_ Raw preprocessing info object that this case represents.
kids_ Child directives.
node_ AST node to which this case is physically attached.
parent_ The directive of which this case is a part.

Created with MrDocs