class IfStmt

Declaration

class IfStmt : public Stmt, private TrailingObjects { /* full declaration omitted */ };

Description

IfStmt - This represents an if/then/else.

Declared at: clang/include/clang/AST/Stmt.h:1936

Inherits from: Stmt, TrailingObjects

Member Variables

private clang::SourceLocation LParenLoc
private clang::SourceLocation RParenLoc

Inherited from Stmt:

protected

Method Overview

Inherited from Stmt:

Methods

static clang::IfStmt* Create(
    const clang::ASTContext& Ctx,
    clang::SourceLocation IL,
    clang::IfStatementKind Kind,
    clang::Stmt* Init,
    clang::VarDecl* Var,
    clang::Expr* Cond,
    clang::SourceLocation LPL,
    clang::SourceLocation RPL,
    clang::Stmt* Then,
    clang::SourceLocation EL =
        clang::SourceLocation(),
    clang::Stmt* Else = nullptr)

Description

Create an IfStmt.

Declared at: clang/include/clang/AST/Stmt.h:1995

Parameters

const clang::ASTContext& Ctx
clang::SourceLocation IL
clang::IfStatementKind Kind
clang::Stmt* Init
clang::VarDecl* Var
clang::Expr* Cond
clang::SourceLocation LPL
clang::SourceLocation RPL
clang::Stmt* Then
clang::SourceLocation EL = clang::SourceLocation()
clang::Stmt* Else = nullptr

static clang::IfStmt* CreateEmpty(
    const clang::ASTContext& Ctx,
    bool HasElse,
    bool HasVar,
    bool HasInit)

Description

Create an empty IfStmt optionally with storage for an else statement, condition variable and init expression.

Declared at: clang/include/clang/AST/Stmt.h:2003

Parameters

const clang::ASTContext& Ctx
bool HasElse
bool HasVar
bool HasInit

IfStmt(const clang::ASTContext& Ctx,
       clang::SourceLocation IL,
       clang::IfStatementKind Kind,
       clang::Stmt* Init,
       clang::VarDecl* Var,
       clang::Expr* Cond,
       clang::SourceLocation LParenLoc,
       clang::SourceLocation RParenLoc,
       clang::Stmt* Then,
       clang::SourceLocation EL,
       clang::Stmt* Else)

Description

Build an if/then/else statement.

Declared at: clang/include/clang/AST/Stmt.h:1986

Parameters

const clang::ASTContext& Ctx
clang::SourceLocation IL
clang::IfStatementKind Kind
clang::Stmt* Init
clang::VarDecl* Var
clang::Expr* Cond
clang::SourceLocation LParenLoc
clang::SourceLocation RParenLoc
clang::Stmt* Then
clang::SourceLocation EL
clang::Stmt* Else

IfStmt(clang::Stmt::EmptyShell Empty,
       bool HasElse,
       bool HasVar,
       bool HasInit)

Description

Build an empty if/then/else statement.

Declared at: clang/include/clang/AST/Stmt.h:1991

Parameters

clang::Stmt::EmptyShell Empty
bool HasElse
bool HasVar
bool HasInit

clang::Stmt::const_child_range children() const

Declared at: clang/include/clang/AST/Stmt.h:2167

clang::Stmt::child_range children()

Declared at: clang/include/clang/AST/Stmt.h:2158

static bool classof(const clang::Stmt* T)

Declared at: clang/include/clang/AST/Stmt.h:2176

Parameters

const clang::Stmt* T

unsigned int condOffset() const

Declared at: clang/include/clang/AST/Stmt.h:1979

unsigned int elseOffset() const

Declared at: clang/include/clang/AST/Stmt.h:1983

clang::SourceLocation getBeginLoc() const

Declared at: clang/include/clang/AST/Stmt.h:2145

clang::Expr* getCond()

Declared at: clang/include/clang/AST/Stmt.h:2015

const clang::Expr* getCond() const

Declared at: clang/include/clang/AST/Stmt.h:2019

const clang::VarDecl* getConditionVariable() const

Declared at: clang/include/clang/AST/Stmt.h:2061

clang::VarDecl* getConditionVariable()

Description

Retrieve the variable declared in this "if" statement, if any. In the following example, "x" is the condition variable.

Declared at: clang/include/clang/AST/Stmt.h:2060

clang::DeclStmt* getConditionVariableDeclStmt()

Description

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

Declared at: clang/include/clang/AST/Stmt.h:2071

const clang::DeclStmt*
getConditionVariableDeclStmt() const

Declared at: clang/include/clang/AST/Stmt.h:2077

clang::Stmt* getElse()

Declared at: clang/include/clang/AST/Stmt.h:2036

const clang::Stmt* getElse() const

Declared at: clang/include/clang/AST/Stmt.h:2041

clang::SourceLocation getElseLoc() const

Declared at: clang/include/clang/AST/Stmt.h:2102

clang::SourceLocation getEndLoc() const

Declared at: clang/include/clang/AST/Stmt.h:2146

clang::SourceLocation getIfLoc() const

Declared at: clang/include/clang/AST/Stmt.h:2099

const clang::Stmt* getInit() const

Declared at: clang/include/clang/AST/Stmt.h:2088

clang::Stmt* getInit()

Declared at: clang/include/clang/AST/Stmt.h:2083

clang::SourceLocation getLParenLoc() const

Declared at: clang/include/clang/AST/Stmt.h:2151

Optional<const clang::Stmt*> getNondiscardedCase(
    const clang::ASTContext& Ctx) const

Description

If this is an 'if constexpr', determine which substatement will be taken. Otherwise, or if the condition is value-dependent, returns None.

Declared at: clang/include/clang/AST/Stmt.h:2140

Parameters

const clang::ASTContext& Ctx

Optional<clang::Stmt*> getNondiscardedCase(
    const clang::ASTContext& Ctx)

Declared at: clang/include/clang/AST/Stmt.h:2141

Parameters

const clang::ASTContext& Ctx

clang::SourceLocation getRParenLoc() const

Declared at: clang/include/clang/AST/Stmt.h:2153

clang::IfStatementKind getStatementKind() const

Declared at: clang/include/clang/AST/Stmt.h:2134

const clang::Stmt* getThen() const

Declared at: clang/include/clang/AST/Stmt.h:2028

clang::Stmt* getThen()

Declared at: clang/include/clang/AST/Stmt.h:2027

bool hasElseStorage() const

Description

True if this IfStmt has storage for an else statement.

Declared at: clang/include/clang/AST/Stmt.h:2013

bool hasInitStorage() const

Description

True if this IfStmt has the storage for an init statement.

Declared at: clang/include/clang/AST/Stmt.h:2007

bool hasVarStorage() const

Description

True if this IfStmt has storage for a variable declaration.

Declared at: clang/include/clang/AST/Stmt.h:2010

unsigned int initOffset() const

Declared at: clang/include/clang/AST/Stmt.h:1977

bool isConsteval() const

Declared at: clang/include/clang/AST/Stmt.h:2113

bool isConstexpr() const

Declared at: clang/include/clang/AST/Stmt.h:2126

bool isNegatedConsteval() const

Declared at: clang/include/clang/AST/Stmt.h:2122

bool isNonNegatedConsteval() const

Declared at: clang/include/clang/AST/Stmt.h:2118

bool isObjCAvailabilityCheck() const

Declared at: clang/include/clang/AST/Stmt.h:2143

unsigned int numTrailingObjects(
    OverloadToken<clang::SourceLocation>) const

Declared at: clang/include/clang/AST/Stmt.h:1973

Parameters

OverloadToken<clang::SourceLocation>

unsigned int numTrailingObjects(
    OverloadToken<clang::Stmt*>) const

Declared at: clang/include/clang/AST/Stmt.h:1968

Parameters

OverloadToken<clang::Stmt*>

void setCond(clang::Expr* Cond)

Declared at: clang/include/clang/AST/Stmt.h:2023

Parameters

clang::Expr* Cond

void setConditionVariable(
    const clang::ASTContext& Ctx,
    clang::VarDecl* V)

Description

Set the condition variable for this if statement. The if statement must have storage for the condition variable.

Declared at: clang/include/clang/AST/Stmt.h:2067

Parameters

const clang::ASTContext& Ctx
clang::VarDecl* V

void setElse(clang::Stmt* Else)

Declared at: clang/include/clang/AST/Stmt.h:2046

Parameters

clang::Stmt* Else

void setElseLoc(clang::SourceLocation ElseLoc)

Declared at: clang/include/clang/AST/Stmt.h:2107

Parameters

clang::SourceLocation ElseLoc

void setIfLoc(clang::SourceLocation IfLoc)

Declared at: clang/include/clang/AST/Stmt.h:2100

Parameters

clang::SourceLocation IfLoc

void setInit(clang::Stmt* Init)

Declared at: clang/include/clang/AST/Stmt.h:2093

Parameters

clang::Stmt* Init

void setLParenLoc(clang::SourceLocation Loc)

Declared at: clang/include/clang/AST/Stmt.h:2152

Parameters

clang::SourceLocation Loc

void setRParenLoc(clang::SourceLocation Loc)

Declared at: clang/include/clang/AST/Stmt.h:2154

Parameters

clang::SourceLocation Loc

void setStatementKind(clang::IfStatementKind Kind)

Declared at: clang/include/clang/AST/Stmt.h:2130

Parameters

clang::IfStatementKind Kind

void setThen(clang::Stmt* Then)

Declared at: clang/include/clang/AST/Stmt.h:2032

Parameters

clang::Stmt* Then

unsigned int thenOffset() const

Declared at: clang/include/clang/AST/Stmt.h:1982

unsigned int varOffset() const

Declared at: clang/include/clang/AST/Stmt.h:1978