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

#include <Stmt.h>

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

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. More...
 
VarDeclgetConditionVariable () const
 Retrieve the variable declared in this "if" statement, if any. More...
 
void setConditionVariable (const ASTContext &C, VarDecl *V)
 
const DeclStmtgetConditionVariableDeclStmt () const
 
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)
 
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 882 of file Stmt.h.

Constructor & Destructor Documentation

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

Definition at line 884 of file Stmt.cpp.

References setConditionVariable().

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 940 of file Stmt.h.

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

Definition at line 944 of file Stmt.h.

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

Definition at line 921 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 894 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 923 of file Stmt.h.

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

Definition at line 927 of file Stmt.h.

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

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

Definition at line 925 of file Stmt.h.

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

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

Definition at line 931 of file Stmt.h.

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

Definition at line 930 of file Stmt.h.

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

Definition at line 922 of file Stmt.h.

void clang::IfStmt::setCond ( Expr E)
inline

Definition at line 915 of file Stmt.h.

void IfStmt::setConditionVariable ( const ASTContext C,
VarDecl V 
)
void clang::IfStmt::setElse ( Stmt S)
inline

Definition at line 919 of file Stmt.h.

References S.

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

Definition at line 928 of file Stmt.h.

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

Definition at line 926 of file Stmt.h.

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

Definition at line 917 of file Stmt.h.

References S.


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