clang  3.9.0
Public Member Functions | Static Public Member Functions | List of all members
clang::IfStmt Class Reference

IfStmt - This represents an if/then/else. More...

#include <Stmt.h>

Inheritance diagram for clang::IfStmt:
[legend]
Collaboration diagram for clang::IfStmt:
[legend]

Public Member Functions

 IfStmt (const ASTContext &C, SourceLocation IL, bool IsConstexpr, Stmt *init, VarDecl *var, Expr *cond, Stmt *then, SourceLocation EL=SourceLocation(), Stmt *elsev=nullptr)
 
 IfStmt (EmptyShell Empty)
 Build an empty if/then/else statement. More...
 
VarDeclgetConditionVariable () const
 Retrieve the variable declared in this "if" statement, if any. More...
 
void setConditionVariable (const ASTContext &C, VarDecl *V)
 
const DeclStmtgetConditionVariableDeclStmt () const
 If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of that condition variable. More...
 
StmtgetInit ()
 
const StmtgetInit () const
 
void setInit (Stmt *S)
 
const ExprgetCond () const
 
void setCond (Expr *E)
 
const StmtgetThen () const
 
void setThen (Stmt *S)
 
const StmtgetElse () const
 
void setElse (Stmt *S)
 
ExprgetCond ()
 
StmtgetThen ()
 
StmtgetElse ()
 
SourceLocation getIfLoc () const
 
void setIfLoc (SourceLocation L)
 
SourceLocation getElseLoc () const
 
void setElseLoc (SourceLocation L)
 
bool isConstexpr () const
 
void setConstexpr (bool C)
 
SourceLocation getLocStart () const LLVM_READONLY
 
SourceLocation getLocEnd () const LLVM_READONLY
 
child_range children ()
 

Static Public Member Functions

static bool classof (const Stmt *T)
 

Detailed Description

IfStmt - This represents an if/then/else.

Definition at line 881 of file Stmt.h.

Constructor & Destructor Documentation

IfStmt::IfStmt ( const ASTContext C,
SourceLocation  IL,
bool  IsConstexpr,
Stmt init,
VarDecl var,
Expr cond,
Stmt then,
SourceLocation  EL = SourceLocation(),
Stmt elsev = nullptr 
)

Definition at line 766 of file Stmt.cpp.

References setConditionVariable(), and setConstexpr().

clang::IfStmt::IfStmt ( EmptyShell  Empty)
inlineexplicit

Build an empty if/then/else statement.

Definition at line 895 of file Stmt.h.

Member Function Documentation

child_range clang::IfStmt::children ( )
inline

Definition at line 946 of file Stmt.h.

static bool clang::IfStmt::classof ( const Stmt T)
inlinestatic

Definition at line 950 of file Stmt.h.

const Expr* clang::IfStmt::getCond ( ) const
inline
Expr* clang::IfStmt::getCond ( )
inline

Definition at line 924 of file Stmt.h.

VarDecl * IfStmt::getConditionVariable ( ) const

Retrieve the variable declared in this "if" statement, if any.

In the following example, "x" is the condition variable.

if (int x = foo()) {
printf("x is %d", x);
}

Definition at line 778 of file Stmt.cpp.

References clang::DeclStmt::getSingleDecl().

Referenced by clang::CodeGen::CodeGenFunction::EmitIfStmt(), EvaluateStmt(), and clang::ASTNodeImporter::VisitIfStmt().

const DeclStmt* clang::IfStmt::getConditionVariableDeclStmt ( ) const
inline

If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of that condition variable.

Definition at line 910 of file Stmt.h.

const Stmt* clang::IfStmt::getElse ( ) const
inline
Stmt* clang::IfStmt::getElse ( )
inline

Definition at line 926 of file Stmt.h.

SourceLocation clang::IfStmt::getElseLoc ( ) const
inline

Definition at line 930 of file Stmt.h.

Referenced by clang::ASTNodeImporter::VisitIfStmt().

SourceLocation clang::IfStmt::getIfLoc ( ) const
inline

Definition at line 928 of file Stmt.h.

Referenced by clang::ASTNodeImporter::VisitIfStmt().

Stmt* clang::IfStmt::getInit ( )
inline
const Stmt* clang::IfStmt::getInit ( ) const
inline

Definition at line 915 of file Stmt.h.

SourceLocation clang::IfStmt::getLocEnd ( ) const
inline

Definition at line 937 of file Stmt.h.

SourceLocation clang::IfStmt::getLocStart ( ) const
inline

Definition at line 936 of file Stmt.h.

const Stmt* clang::IfStmt::getThen ( ) const
inline
Stmt* clang::IfStmt::getThen ( )
inline

Definition at line 925 of file Stmt.h.

bool clang::IfStmt::isConstexpr ( ) const
inline
void clang::IfStmt::setCond ( Expr E)
inline

Definition at line 918 of file Stmt.h.

References E.

void IfStmt::setConditionVariable ( const ASTContext C,
VarDecl V 
)
void clang::IfStmt::setConstexpr ( bool  C)
inline

Definition at line 934 of file Stmt.h.

Referenced by IfStmt().

void clang::IfStmt::setElse ( Stmt S)
inline

Definition at line 922 of file Stmt.h.

References S.

void clang::IfStmt::setElseLoc ( SourceLocation  L)
inline

Definition at line 931 of file Stmt.h.

void clang::IfStmt::setIfLoc ( SourceLocation  L)
inline

Definition at line 929 of file Stmt.h.

void clang::IfStmt::setInit ( Stmt S)
inline

Definition at line 916 of file Stmt.h.

References S.

void clang::IfStmt::setThen ( Stmt S)
inline

Definition at line 920 of file Stmt.h.

References S.


The documentation for this class was generated from the following files: