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:
Method Overview
- public 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)
- public static clang::IfStmt * CreateEmpty(const clang::ASTContext & Ctx, bool HasElse, bool HasVar, bool HasInit)
- private 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)
- private IfStmt(clang::Stmt::EmptyShell Empty, bool HasElse, bool HasVar, bool HasInit)
- public clang::Stmt::const_child_range children() const
- public clang::Stmt::child_range children()
- public static bool classof(const clang::Stmt * T)
- private unsigned int condOffset() const
- private unsigned int elseOffset() const
- public clang::SourceLocation getBeginLoc() const
- public clang::Expr * getCond()
- public const clang::Expr * getCond() const
- public const clang::VarDecl * getConditionVariable() const
- public clang::VarDecl * getConditionVariable()
- public clang::DeclStmt * getConditionVariableDeclStmt()
- public const clang::DeclStmt * getConditionVariableDeclStmt() const
- public clang::Stmt * getElse()
- public const clang::Stmt * getElse() const
- public clang::SourceLocation getElseLoc() const
- public clang::SourceLocation getEndLoc() const
- public clang::SourceLocation getIfLoc() const
- public const clang::Stmt * getInit() const
- public clang::Stmt * getInit()
- public clang::SourceLocation getLParenLoc() const
- public Optional<const clang::Stmt *> getNondiscardedCase(const clang::ASTContext & Ctx) const
- public Optional<clang::Stmt *> getNondiscardedCase(const clang::ASTContext & Ctx)
- public clang::SourceLocation getRParenLoc() const
- public clang::IfStatementKind getStatementKind() const
- public const clang::Stmt * getThen() const
- public clang::Stmt * getThen()
- public bool hasElseStorage() const
- public bool hasInitStorage() const
- public bool hasVarStorage() const
- private unsigned int initOffset() const
- public bool isConsteval() const
- public bool isConstexpr() const
- public bool isNegatedConsteval() const
- public bool isNonNegatedConsteval() const
- public bool isObjCAvailabilityCheck() const
- private unsigned int numTrailingObjects(OverloadToken<clang::SourceLocation>) const
- private unsigned int numTrailingObjects(OverloadToken<clang::Stmt *>) const
- public void setCond(clang::Expr * Cond)
- public void setConditionVariable(const clang::ASTContext & Ctx, clang::VarDecl * V)
- public void setElse(clang::Stmt * Else)
- public void setElseLoc(clang::SourceLocation ElseLoc)
- public void setIfLoc(clang::SourceLocation IfLoc)
- public void setInit(clang::Stmt * Init)
- public void setLParenLoc(clang::SourceLocation Loc)
- public void setRParenLoc(clang::SourceLocation Loc)
- public void setStatementKind(clang::IfStatementKind Kind)
- public void setThen(clang::Stmt * Then)
- private unsigned int thenOffset() const
- private unsigned int varOffset() const
Inherited from Stmt:
- public EnableStatistics
- public IgnoreContainers
- public IgnoreContainers
- public PrintStats
- public ProcessODRHash
- public Profile
- public addStmtClass
- public child_begin
- public child_begin
- public child_end
- public child_end
- public children
- public children
- public determineLikelihoodConflict
- public dump
- public dump
- public dumpColor
- public dumpPretty
- public getBeginLoc
- public getEndLoc
- public getID
- public getLikelihood
- public getLikelihood
- public getLikelihood
- public getLikelihoodAttr
- public getSourceRange
- public getStmtClass
- public getStmtClassName
- public printJson
- public printPretty
- public printPrettyControlled
- public stripLabelLikeStatements
- public stripLabelLikeStatements
- public viewAST
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)
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)
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)
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)
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
clang::Stmt::const_child_range children() const
Declared at: clang/include/clang/AST/Stmt.h:2167
¶clang::Stmt::child_range children()
clang::Stmt::child_range children()
Declared at: clang/include/clang/AST/Stmt.h:2158
¶static bool classof(const clang::Stmt* T)
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
unsigned int condOffset() const
Declared at: clang/include/clang/AST/Stmt.h:1979
¶unsigned int elseOffset() const
unsigned int elseOffset() const
Declared at: clang/include/clang/AST/Stmt.h:1983
¶clang::SourceLocation getBeginLoc() const
clang::SourceLocation getBeginLoc() const
Declared at: clang/include/clang/AST/Stmt.h:2145
¶clang::Expr* getCond()
clang::Expr* getCond()
Declared at: clang/include/clang/AST/Stmt.h:2015
¶const clang::Expr* getCond() const
const clang::Expr* getCond() const
Declared at: clang/include/clang/AST/Stmt.h:2019
¶const clang::VarDecl* getConditionVariable() const
const clang::VarDecl* getConditionVariable() const
Declared at: clang/include/clang/AST/Stmt.h:2061
¶clang::VarDecl* getConditionVariable()
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()
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
const clang::DeclStmt*
getConditionVariableDeclStmt() const
Declared at: clang/include/clang/AST/Stmt.h:2077
¶clang::Stmt* getElse()
clang::Stmt* getElse()
Declared at: clang/include/clang/AST/Stmt.h:2036
¶const clang::Stmt* getElse() const
const clang::Stmt* getElse() const
Declared at: clang/include/clang/AST/Stmt.h:2041
¶clang::SourceLocation getElseLoc() const
clang::SourceLocation getElseLoc() const
Declared at: clang/include/clang/AST/Stmt.h:2102
¶clang::SourceLocation getEndLoc() const
clang::SourceLocation getEndLoc() const
Declared at: clang/include/clang/AST/Stmt.h:2146
¶clang::SourceLocation getIfLoc() const
clang::SourceLocation getIfLoc() const
Declared at: clang/include/clang/AST/Stmt.h:2099
¶const clang::Stmt* getInit() const
const clang::Stmt* getInit() const
Declared at: clang/include/clang/AST/Stmt.h:2088
¶clang::Stmt* getInit()
clang::Stmt* getInit()
Declared at: clang/include/clang/AST/Stmt.h:2083
¶clang::SourceLocation getLParenLoc() const
clang::SourceLocation getLParenLoc() const
Declared at: clang/include/clang/AST/Stmt.h:2151
¶Optional<const clang::Stmt*> getNondiscardedCase(
const clang::ASTContext& Ctx) const
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)
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
clang::SourceLocation getRParenLoc() const
Declared at: clang/include/clang/AST/Stmt.h:2153
¶clang::IfStatementKind getStatementKind() const
clang::IfStatementKind getStatementKind() const
Declared at: clang/include/clang/AST/Stmt.h:2134
¶const clang::Stmt* getThen() const
const clang::Stmt* getThen() const
Declared at: clang/include/clang/AST/Stmt.h:2028
¶clang::Stmt* getThen()
clang::Stmt* getThen()
Declared at: clang/include/clang/AST/Stmt.h:2027
¶bool hasElseStorage() const
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
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
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
unsigned int initOffset() const
Declared at: clang/include/clang/AST/Stmt.h:1977
¶bool isConsteval() const
bool isConsteval() const
Declared at: clang/include/clang/AST/Stmt.h:2113
¶bool isConstexpr() const
bool isConstexpr() const
Declared at: clang/include/clang/AST/Stmt.h:2126
¶bool isNegatedConsteval() const
bool isNegatedConsteval() const
Declared at: clang/include/clang/AST/Stmt.h:2122
¶bool isNonNegatedConsteval() const
bool isNonNegatedConsteval() const
Declared at: clang/include/clang/AST/Stmt.h:2118
¶bool isObjCAvailabilityCheck() const
bool isObjCAvailabilityCheck() const
Declared at: clang/include/clang/AST/Stmt.h:2143
¶unsigned int numTrailingObjects(
OverloadToken<clang::SourceLocation>) const
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
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)
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)
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)
void setElse(clang::Stmt* Else)
Declared at: clang/include/clang/AST/Stmt.h:2046
Parameters
- clang::Stmt* Else
¶void setElseLoc(clang::SourceLocation ElseLoc)
void setElseLoc(clang::SourceLocation ElseLoc)
Declared at: clang/include/clang/AST/Stmt.h:2107
Parameters
- clang::SourceLocation ElseLoc
¶void setIfLoc(clang::SourceLocation IfLoc)
void setIfLoc(clang::SourceLocation IfLoc)
Declared at: clang/include/clang/AST/Stmt.h:2100
Parameters
- clang::SourceLocation IfLoc
¶void setInit(clang::Stmt* Init)
void setInit(clang::Stmt* Init)
Declared at: clang/include/clang/AST/Stmt.h:2093
Parameters
- clang::Stmt* Init
¶void setLParenLoc(clang::SourceLocation Loc)
void setLParenLoc(clang::SourceLocation Loc)
Declared at: clang/include/clang/AST/Stmt.h:2152
Parameters
¶void setRParenLoc(clang::SourceLocation Loc)
void setRParenLoc(clang::SourceLocation Loc)
Declared at: clang/include/clang/AST/Stmt.h:2154
Parameters
¶void setStatementKind(clang::IfStatementKind Kind)
void setStatementKind(clang::IfStatementKind Kind)
Declared at: clang/include/clang/AST/Stmt.h:2130
Parameters
- clang::IfStatementKind Kind
¶void setThen(clang::Stmt* Then)
void setThen(clang::Stmt* Then)
Declared at: clang/include/clang/AST/Stmt.h:2032
Parameters
- clang::Stmt* Then
¶unsigned int thenOffset() const
unsigned int thenOffset() const
Declared at: clang/include/clang/AST/Stmt.h:1982
¶unsigned int varOffset() const
unsigned int varOffset() const
Declared at: clang/include/clang/AST/Stmt.h:1978