class SwitchStmt
Declaration
class SwitchStmt : public Stmt, private TrailingObjects { /* full declaration omitted */ };
Description
SwitchStmt - This represents a 'switch' stmt.
Declared at: clang/include/clang/AST/Stmt.h:2182
Inherits from: Stmt, TrailingObjects
Member Variables
- private clang::SwitchCase* FirstCase = nullptr
- Points to a linked list of case and default statements.
- private clang::SourceLocation LParenLoc
- private clang::SourceLocation RParenLoc
Inherited from Stmt:
Method Overview
- public static clang::SwitchStmt * Create(const clang::ASTContext & Ctx, clang::Stmt * Init, clang::VarDecl * Var, clang::Expr * Cond, clang::SourceLocation LParenLoc, clang::SourceLocation RParenLoc)
- public static clang::SwitchStmt * CreateEmpty(const clang::ASTContext & Ctx, bool HasInit, bool HasVar)
- private SwitchStmt(const clang::ASTContext & Ctx, clang::Stmt * Init, clang::VarDecl * Var, clang::Expr * Cond, clang::SourceLocation LParenLoc, clang::SourceLocation RParenLoc)
- private SwitchStmt(clang::Stmt::EmptyShell Empty, bool HasInit, bool HasVar)
- public void addSwitchCase(clang::SwitchCase * SC)
- private unsigned int bodyOffset() const
- 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
- public clang::SourceLocation getBeginLoc() const
- public clang::Stmt * getBody()
- public const clang::Stmt * getBody() const
- public clang::Expr * getCond()
- public const clang::Expr * getCond() const
- public const clang::VarDecl * getConditionVariable() const
- public clang::VarDecl * getConditionVariable()
- public const clang::DeclStmt * getConditionVariableDeclStmt() const
- public clang::DeclStmt * getConditionVariableDeclStmt()
- public clang::SourceLocation getEndLoc() const
- public const clang::Stmt * getInit() const
- public clang::Stmt * getInit()
- public clang::SourceLocation getLParenLoc() const
- public clang::SourceLocation getRParenLoc() const
- public clang::SwitchCase * getSwitchCaseList()
- public const clang::SwitchCase * getSwitchCaseList() const
- public clang::SourceLocation getSwitchLoc() const
- public bool hasInitStorage() const
- public bool hasVarStorage() const
- private unsigned int initOffset() const
- public bool isAllEnumCasesCovered() const
- private unsigned int numTrailingObjects(OverloadToken<clang::Stmt *>) const
- public void setAllEnumCasesCovered()
- public void setBody(clang::Stmt * S, clang::SourceLocation SL)
- public void setBody(clang::Stmt * Body)
- public void setCond(clang::Expr * Cond)
- public void setConditionVariable(const clang::ASTContext & Ctx, clang::VarDecl * VD)
- public void setInit(clang::Stmt * Init)
- public void setLParenLoc(clang::SourceLocation Loc)
- public void setRParenLoc(clang::SourceLocation Loc)
- public void setSwitchCaseList(clang::SwitchCase * SC)
- public void setSwitchLoc(clang::SourceLocation L)
- 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::SwitchStmt* Create(
const clang::ASTContext& Ctx,
clang::Stmt* Init,
clang::VarDecl* Var,
clang::Expr* Cond,
clang::SourceLocation LParenLoc,
clang::SourceLocation RParenLoc)
static clang::SwitchStmt* Create(
const clang::ASTContext& Ctx,
clang::Stmt* Init,
clang::VarDecl* Var,
clang::Expr* Cond,
clang::SourceLocation LParenLoc,
clang::SourceLocation RParenLoc)
Description
Create a switch statement.
Declared at: clang/include/clang/AST/Stmt.h:2231
Parameters
- const clang::ASTContext& Ctx
- clang::Stmt* Init
- clang::VarDecl* Var
- clang::Expr* Cond
- clang::SourceLocation LParenLoc
- clang::SourceLocation RParenLoc
¶static clang::SwitchStmt* CreateEmpty(
const clang::ASTContext& Ctx,
bool HasInit,
bool HasVar)
static clang::SwitchStmt* CreateEmpty(
const clang::ASTContext& Ctx,
bool HasInit,
bool HasVar)
Description
Create an empty switch statement optionally with storage for an init expression and a condition variable.
Declared at: clang/include/clang/AST/Stmt.h:2237
Parameters
- const clang::ASTContext& Ctx
- bool HasInit
- bool HasVar
¶SwitchStmt(const clang::ASTContext& Ctx,
clang::Stmt* Init,
clang::VarDecl* Var,
clang::Expr* Cond,
clang::SourceLocation LParenLoc,
clang::SourceLocation RParenLoc)
SwitchStmt(const clang::ASTContext& Ctx,
clang::Stmt* Init,
clang::VarDecl* Var,
clang::Expr* Cond,
clang::SourceLocation LParenLoc,
clang::SourceLocation RParenLoc)
Description
Build a switch statement.
Declared at: clang/include/clang/AST/Stmt.h:2223
Parameters
- const clang::ASTContext& Ctx
- clang::Stmt* Init
- clang::VarDecl* Var
- clang::Expr* Cond
- clang::SourceLocation LParenLoc
- clang::SourceLocation RParenLoc
¶SwitchStmt(clang::Stmt::EmptyShell Empty,
bool HasInit,
bool HasVar)
SwitchStmt(clang::Stmt::EmptyShell Empty,
bool HasInit,
bool HasVar)
Description
Build a empty switch statement.
Declared at: clang/include/clang/AST/Stmt.h:2227
Parameters
- clang::Stmt::EmptyShell Empty
- bool HasInit
- bool HasVar
¶void addSwitchCase(clang::SwitchCase* SC)
void addSwitchCase(clang::SwitchCase* SC)
Declared at: clang/include/clang/AST/Stmt.h:2331
Parameters
¶unsigned int bodyOffset() const
unsigned int bodyOffset() const
Declared at: clang/include/clang/AST/Stmt.h:2220
¶clang::Stmt::const_child_range children() const
clang::Stmt::const_child_range children() const
Declared at: clang/include/clang/AST/Stmt.h:2361
¶clang::Stmt::child_range children()
clang::Stmt::child_range children()
Declared at: clang/include/clang/AST/Stmt.h:2355
¶static bool classof(const clang::Stmt* T)
static bool classof(const clang::Stmt* T)
Declared at: clang/include/clang/AST/Stmt.h:2367
Parameters
- const clang::Stmt* T
¶unsigned int condOffset() const
unsigned int condOffset() const
Declared at: clang/include/clang/AST/Stmt.h:2217
¶clang::SourceLocation getBeginLoc() const
clang::SourceLocation getBeginLoc() const
Declared at: clang/include/clang/AST/Stmt.h:2348
¶clang::Stmt* getBody()
clang::Stmt* getBody()
Declared at: clang/include/clang/AST/Stmt.h:2258
¶const clang::Stmt* getBody() const
const clang::Stmt* getBody() const
Declared at: clang/include/clang/AST/Stmt.h:2259
¶clang::Expr* getCond()
clang::Expr* getCond()
Declared at: clang/include/clang/AST/Stmt.h:2246
¶const clang::Expr* getCond() const
const clang::Expr* getCond() const
Declared at: clang/include/clang/AST/Stmt.h:2250
¶const clang::VarDecl* getConditionVariable() const
const clang::VarDecl* getConditionVariable() const
Declared at: clang/include/clang/AST/Stmt.h:2293
¶clang::VarDecl* getConditionVariable()
clang::VarDecl* getConditionVariable()
Description
Retrieve the variable declared in this "switch" statement, if any. In the following example, "x" is the condition variable.
Declared at: clang/include/clang/AST/Stmt.h:2292
¶const clang::DeclStmt*
getConditionVariableDeclStmt() const
const clang::DeclStmt*
getConditionVariableDeclStmt() const
Declared at: clang/include/clang/AST/Stmt.h:2309
¶clang::DeclStmt* getConditionVariableDeclStmt()
clang::DeclStmt* getConditionVariableDeclStmt()
Description
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of that condition variable.
Declared at: clang/include/clang/AST/Stmt.h:2303
¶clang::SourceLocation getEndLoc() const
clang::SourceLocation getEndLoc() const
Declared at: clang/include/clang/AST/Stmt.h:2349
¶const clang::Stmt* getInit() const
const clang::Stmt* getInit() const
Declared at: clang/include/clang/AST/Stmt.h:2272
¶clang::Stmt* getInit()
clang::Stmt* getInit()
Declared at: clang/include/clang/AST/Stmt.h:2267
¶clang::SourceLocation getLParenLoc() const
clang::SourceLocation getLParenLoc() const
Declared at: clang/include/clang/AST/Stmt.h:2321
¶clang::SourceLocation getRParenLoc() const
clang::SourceLocation getRParenLoc() const
Declared at: clang/include/clang/AST/Stmt.h:2323
¶clang::SwitchCase* getSwitchCaseList()
clang::SwitchCase* getSwitchCaseList()
Declared at: clang/include/clang/AST/Stmt.h:2315
¶const clang::SwitchCase* getSwitchCaseList() const
const clang::SwitchCase* getSwitchCaseList() const
Declared at: clang/include/clang/AST/Stmt.h:2316
¶clang::SourceLocation getSwitchLoc() const
clang::SourceLocation getSwitchLoc() const
Declared at: clang/include/clang/AST/Stmt.h:2319
¶bool hasInitStorage() const
bool hasInitStorage() const
Description
True if this SwitchStmt has storage for an init statement.
Declared at: clang/include/clang/AST/Stmt.h:2241
¶bool hasVarStorage() const
bool hasVarStorage() const
Description
True if this SwitchStmt has storage for a condition variable.
Declared at: clang/include/clang/AST/Stmt.h:2244
¶unsigned int initOffset() const
unsigned int initOffset() const
Declared at: clang/include/clang/AST/Stmt.h:2215
¶bool isAllEnumCasesCovered() const
bool isAllEnumCasesCovered() const
Description
Returns true if the SwitchStmt is a switch of an enum value and all cases have been explicitly covered.
Declared at: clang/include/clang/AST/Stmt.h:2344
¶unsigned int numTrailingObjects(
OverloadToken<clang::Stmt*>) const
unsigned int numTrailingObjects(
OverloadToken<clang::Stmt*>) const
Declared at: clang/include/clang/AST/Stmt.h:2211
Parameters
- OverloadToken<clang::Stmt*>
¶void setAllEnumCasesCovered()
void setAllEnumCasesCovered()
Description
Set a flag in the SwitchStmt indicating that if the 'switch (X)' is a switch over an enum value then all cases have been explicitly covered.
Declared at: clang/include/clang/AST/Stmt.h:2340
¶void setBody(clang::Stmt* S,
clang::SourceLocation SL)
void setBody(clang::Stmt* S,
clang::SourceLocation SL)
Declared at: clang/include/clang/AST/Stmt.h:2326
Parameters
¶void setBody(clang::Stmt* Body)
void setBody(clang::Stmt* Body)
Declared at: clang/include/clang/AST/Stmt.h:2263
Parameters
- clang::Stmt* Body
¶void setCond(clang::Expr* Cond)
void setCond(clang::Expr* Cond)
Declared at: clang/include/clang/AST/Stmt.h:2254
Parameters
- clang::Expr* Cond
¶void setConditionVariable(
const clang::ASTContext& Ctx,
clang::VarDecl* VD)
void setConditionVariable(
const clang::ASTContext& Ctx,
clang::VarDecl* VD)
Description
Set the condition variable in this switch statement. The switch statement must have storage for it.
Declared at: clang/include/clang/AST/Stmt.h:2299
Parameters
- const clang::ASTContext& Ctx
- clang::VarDecl* VD
¶void setInit(clang::Stmt* Init)
void setInit(clang::Stmt* Init)
Declared at: clang/include/clang/AST/Stmt.h:2277
Parameters
- clang::Stmt* Init
¶void setLParenLoc(clang::SourceLocation Loc)
void setLParenLoc(clang::SourceLocation Loc)
Declared at: clang/include/clang/AST/Stmt.h:2322
Parameters
¶void setRParenLoc(clang::SourceLocation Loc)
void setRParenLoc(clang::SourceLocation Loc)
Declared at: clang/include/clang/AST/Stmt.h:2324
Parameters
¶void setSwitchCaseList(clang::SwitchCase* SC)
void setSwitchCaseList(clang::SwitchCase* SC)
Declared at: clang/include/clang/AST/Stmt.h:2317
Parameters
¶void setSwitchLoc(clang::SourceLocation L)
void setSwitchLoc(clang::SourceLocation L)
Declared at: clang/include/clang/AST/Stmt.h:2320
Parameters
¶unsigned int varOffset() const
unsigned int varOffset() const
Declared at: clang/include/clang/AST/Stmt.h:2216