clang API Documentation
#include <Stmt.h>
Public Member Functions | |
SwitchStmt (const ASTContext &C, VarDecl *Var, Expr *cond) | |
SwitchStmt (EmptyShell Empty) | |
Build a empty switch statement. | |
VarDecl * | getConditionVariable () const |
Retrieve the variable declared in this "switch" statement, if any. | |
void | setConditionVariable (const ASTContext &C, VarDecl *V) |
const DeclStmt * | getConditionVariableDeclStmt () const |
const Expr * | getCond () const |
const Stmt * | getBody () const |
const SwitchCase * | getSwitchCaseList () const |
Expr * | getCond () |
void | setCond (Expr *E) |
Stmt * | getBody () |
void | setBody (Stmt *S) |
SwitchCase * | getSwitchCaseList () |
void | setSwitchCaseList (SwitchCase *SC) |
Set the case list for this switch statement. | |
SourceLocation | getSwitchLoc () const |
void | setSwitchLoc (SourceLocation L) |
void | setBody (Stmt *S, SourceLocation SL) |
void | addSwitchCase (SwitchCase *SC) |
void | setAllEnumCasesCovered () |
bool | isAllEnumCasesCovered () const |
SourceLocation | getLocStart () const LLVM_READONLY |
SourceLocation | getLocEnd () const LLVM_READONLY |
child_range | children () |
Static Public Member Functions | |
static bool | classof (const Stmt *T) |
SwitchStmt - This represents a 'switch' stmt.
SwitchStmt::SwitchStmt | ( | const ASTContext & | C, |
VarDecl * | Var, | ||
Expr * | cond | ||
) |
Definition at line 936 of file Stmt.cpp.
References setConditionVariable().
clang::SwitchStmt::SwitchStmt | ( | EmptyShell | Empty | ) | [inline, explicit] |
void clang::SwitchStmt::addSwitchCase | ( | SwitchCase * | SC | ) | [inline] |
Definition at line 997 of file Stmt.h.
References clang::SwitchCase::getNextSwitchCase(), and clang::SwitchCase::setNextSwitchCase().
child_range clang::SwitchStmt::children | ( | ) | [inline] |
Reimplemented from clang::Stmt.
static bool clang::SwitchStmt::classof | ( | const Stmt * | T | ) | [inline, static] |
Definition at line 1026 of file Stmt.h.
References clang::Stmt::getStmtClass().
const Stmt* clang::SwitchStmt::getBody | ( | ) | const [inline] |
Definition at line 978 of file Stmt.h.
Referenced by clang::CodeGen::CodeGenFunction::EmitSwitchStmt(), EvaluateSwitch(), and FindCaseStatementsForValue().
Stmt* clang::SwitchStmt::getBody | ( | ) | [inline] |
const Expr* clang::SwitchStmt::getCond | ( | ) | const [inline] |
Definition at line 977 of file Stmt.h.
Referenced by clang::Sema::ActOnFinishSwitchStmt(), clang::Sema::CodeCompleteCase(), clang::CodeGen::CodeGenFunction::EmitSwitchStmt(), EvaluateSwitch(), and clang::ento::ExprEngine::processSwitch().
Expr* clang::SwitchStmt::getCond | ( | ) | [inline] |
VarDecl * SwitchStmt::getConditionVariable | ( | ) | const |
Retrieve the variable declared in this "switch" statement, if any.
In the following example, "x" is the condition variable.
switch (int x = foo()) { case 0: break; // ... }
Definition at line 944 of file Stmt.cpp.
References clang::DeclStmt::getSingleDecl().
Referenced by clang::CodeGen::CodeGenFunction::EmitSwitchStmt(), and EvaluateSwitch().
const DeclStmt* clang::SwitchStmt::getConditionVariableDeclStmt | ( | ) | const [inline] |
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of that condition variable.
SourceLocation clang::SwitchStmt::getLocEnd | ( | ) | const [inline] |
Reimplemented from clang::Stmt.
Definition at line 1017 of file Stmt.h.
References clang::Stmt::getLocEnd().
SourceLocation clang::SwitchStmt::getLocStart | ( | ) | const [inline] |
Reimplemented from clang::Stmt.
const SwitchCase* clang::SwitchStmt::getSwitchCaseList | ( | ) | const [inline] |
Definition at line 979 of file Stmt.h.
Referenced by clang::Sema::ActOnFinishSwitchStmt(), clang::Sema::CodeCompleteCase(), clang::CodeGen::CodeGenFunction::EmitSwitchStmt(), EvaluateSwitch(), and FindCaseStatementsForValue().
SwitchCase* clang::SwitchStmt::getSwitchCaseList | ( | ) | [inline] |
SourceLocation clang::SwitchStmt::getSwitchLoc | ( | ) | const [inline] |
bool clang::SwitchStmt::isAllEnumCasesCovered | ( | ) | const [inline] |
Returns true if the SwitchStmt is a switch of an enum value and all cases have been explicitly covered.
Definition at line 1012 of file Stmt.h.
Referenced by clang::ento::ExprEngine::processSwitch().
void clang::SwitchStmt::setAllEnumCasesCovered | ( | ) | [inline] |
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.
Definition at line 1006 of file Stmt.h.
Referenced by clang::Sema::ActOnFinishSwitchStmt().
void clang::SwitchStmt::setBody | ( | Stmt * | S | ) | [inline] |
Definition at line 984 of file Stmt.h.
References S.
Referenced by clang::Sema::ActOnFinishSwitchStmt().
void clang::SwitchStmt::setBody | ( | Stmt * | S, |
SourceLocation | SL | ||
) | [inline] |
void clang::SwitchStmt::setCond | ( | Expr * | E | ) | [inline] |
void SwitchStmt::setConditionVariable | ( | const ASTContext & | C, |
VarDecl * | V | ||
) |
Definition at line 952 of file Stmt.cpp.
References AttributeLangSupport::C, clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), and clang::VarDecl::getSourceRange().
Referenced by SwitchStmt().
void clang::SwitchStmt::setSwitchCaseList | ( | SwitchCase * | SC | ) | [inline] |
void clang::SwitchStmt::setSwitchLoc | ( | SourceLocation | L | ) | [inline] |