clang API Documentation
#include <Stmt.h>
Public Member Functions | |
IfStmt (const ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond, Stmt *then, SourceLocation EL=SourceLocation(), Stmt *elsev=nullptr) | |
IfStmt (EmptyShell Empty) | |
Build an empty if/then/else statement. | |
VarDecl * | getConditionVariable () const |
Retrieve the variable declared in this "if" statement, if any. | |
void | setConditionVariable (const ASTContext &C, VarDecl *V) |
const DeclStmt * | getConditionVariableDeclStmt () const |
const Expr * | getCond () const |
void | setCond (Expr *E) |
const Stmt * | getThen () const |
void | setThen (Stmt *S) |
const Stmt * | getElse () const |
void | setElse (Stmt *S) |
Expr * | getCond () |
Stmt * | getThen () |
Stmt * | getElse () |
SourceLocation | getIfLoc () const |
void | setIfLoc (SourceLocation L) |
SourceLocation | getElseLoc () const |
void | setElseLoc (SourceLocation L) |
SourceLocation | getLocStart () const LLVM_READONLY |
SourceLocation | getLocEnd () const LLVM_READONLY |
child_range | children () |
Static Public Member Functions | |
static bool | classof (const Stmt *T) |
IfStmt::IfStmt | ( | const ASTContext & | C, |
SourceLocation | IL, | ||
VarDecl * | var, | ||
Expr * | cond, | ||
Stmt * | then, | ||
SourceLocation | EL = SourceLocation() , |
||
Stmt * | elsev = nullptr |
||
) |
Definition at line 876 of file Stmt.cpp.
References setConditionVariable().
clang::IfStmt::IfStmt | ( | EmptyShell | Empty | ) | [inline, explicit] |
child_range clang::IfStmt::children | ( | ) | [inline] |
Reimplemented from clang::Stmt.
static bool clang::IfStmt::classof | ( | const Stmt * | T | ) | [inline, static] |
Definition at line 934 of file Stmt.h.
References clang::Stmt::getStmtClass().
const Expr* clang::IfStmt::getCond | ( | ) | const [inline] |
Definition at line 904 of file Stmt.h.
Referenced by DiagUninitUse(), clang::CodeGen::CodeGenFunction::EmitIfStmt(), EvaluateStmt(), and isIdenticalStmt().
Expr* clang::IfStmt::getCond | ( | ) | [inline] |
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 886 of file Stmt.cpp.
References clang::DeclStmt::getSingleDecl().
Referenced by clang::CodeGen::CodeGenFunction::EmitIfStmt(), and EvaluateStmt().
const DeclStmt* clang::IfStmt::getConditionVariableDeclStmt | ( | ) | const [inline] |
const Stmt* clang::IfStmt::getElse | ( | ) | const [inline] |
Definition at line 908 of file Stmt.h.
Referenced by CheckConstexprFunctionStmt(), DiagUninitUse(), clang::CodeGen::CodeGenFunction::EmitIfStmt(), EvaluateStmt(), and isIdenticalStmt().
Stmt* clang::IfStmt::getElse | ( | ) | [inline] |
SourceLocation clang::IfStmt::getElseLoc | ( | ) | const [inline] |
SourceLocation clang::IfStmt::getIfLoc | ( | ) | const [inline] |
SourceLocation clang::IfStmt::getLocEnd | ( | ) | const [inline] |
Reimplemented from clang::Stmt.
Definition at line 921 of file Stmt.h.
References clang::Stmt::getLocEnd().
SourceLocation clang::IfStmt::getLocStart | ( | ) | const [inline] |
Reimplemented from clang::Stmt.
const Stmt* clang::IfStmt::getThen | ( | ) | const [inline] |
Definition at line 906 of file Stmt.h.
Referenced by CheckConstexprFunctionStmt(), DiagUninitUse(), clang::CodeGen::CodeGenFunction::EmitIfStmt(), EvaluateStmt(), and isIdenticalStmt().
Stmt* clang::IfStmt::getThen | ( | ) | [inline] |
void clang::IfStmt::setCond | ( | Expr * | E | ) | [inline] |
void IfStmt::setConditionVariable | ( | const ASTContext & | C, |
VarDecl * | V | ||
) |
Definition at line 894 of file Stmt.cpp.
References AttributeLangSupport::C, clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), and clang::VarDecl::getSourceRange().
Referenced by IfStmt().
void clang::IfStmt::setElse | ( | Stmt * | S | ) | [inline] |
void clang::IfStmt::setElseLoc | ( | SourceLocation | L | ) | [inline] |
void clang::IfStmt::setIfLoc | ( | SourceLocation | L | ) | [inline] |
void clang::IfStmt::setThen | ( | Stmt * | S | ) | [inline] |