clang API Documentation

Public Member Functions | Static Public Member Functions
clang::IfStmt Class Reference

#include <Stmt.h>

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

List of all members.

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.
VarDeclgetConditionVariable () const
 Retrieve the variable declared in this "if" statement, if any.
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 872 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 876 of file Stmt.cpp.

References setConditionVariable().

clang::IfStmt::IfStmt ( EmptyShell  Empty) [inline, explicit]

Build an empty if/then/else statement.

Definition at line 885 of file Stmt.h.


Member Function Documentation

Reimplemented from clang::Stmt.

Definition at line 930 of file Stmt.h.

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

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().

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

Definition at line 900 of file Stmt.h.

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

Definition at line 913 of file Stmt.h.

Definition at line 917 of file Stmt.h.

Definition at line 915 of file Stmt.h.

Reimplemented from clang::Stmt.

Definition at line 921 of file Stmt.h.

References clang::Stmt::getLocEnd().

Reimplemented from clang::Stmt.

Definition at line 920 of file Stmt.h.

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

Definition at line 912 of file Stmt.h.

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

Definition at line 905 of file Stmt.h.

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

Definition at line 909 of file Stmt.h.

References S.

Definition at line 918 of file Stmt.h.

Definition at line 916 of file Stmt.h.

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

Definition at line 907 of file Stmt.h.

References S.


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