clang  3.8.0
Public Member Functions | Static Public Member Functions | List of all members
clang::SwitchStmt Class Reference

SwitchStmt - This represents a 'switch' stmt. More...

#include <Stmt.h>

Inheritance diagram for clang::SwitchStmt:
[legend]
Collaboration diagram for clang::SwitchStmt:
[legend]

Public Member Functions

 SwitchStmt (const ASTContext &C, VarDecl *Var, Expr *cond)
 
 SwitchStmt (EmptyShell Empty)
 Build a empty switch statement. More...
 
VarDeclgetConditionVariable () const
 Retrieve the variable declared in this "switch" statement, if any. More...
 
void setConditionVariable (const ASTContext &C, VarDecl *V)
 
const DeclStmtgetConditionVariableDeclStmt () const
 If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of that condition variable. More...
 
const ExprgetCond () const
 
const StmtgetBody () const
 
const SwitchCasegetSwitchCaseList () const
 
ExprgetCond ()
 
void setCond (Expr *E)
 
StmtgetBody ()
 
void setBody (Stmt *S)
 
SwitchCasegetSwitchCaseList ()
 
void setSwitchCaseList (SwitchCase *SC)
 Set the case list for this switch statement. More...
 
SourceLocation getSwitchLoc () const
 
void setSwitchLoc (SourceLocation L)
 
void setBody (Stmt *S, SourceLocation SL)
 
void addSwitchCase (SwitchCase *SC)
 
void setAllEnumCasesCovered ()
 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. More...
 
bool isAllEnumCasesCovered () const
 Returns true if the SwitchStmt is a switch of an enum value and all cases have been explicitly covered. More...
 
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

SwitchStmt - This represents a 'switch' stmt.

Definition at line 938 of file Stmt.h.

Constructor & Destructor Documentation

SwitchStmt::SwitchStmt ( const ASTContext C,
VarDecl Var,
Expr cond 
)

Definition at line 819 of file Stmt.cpp.

References setConditionVariable().

clang::SwitchStmt::SwitchStmt ( EmptyShell  Empty)
inlineexplicit

Build a empty switch statement.

Definition at line 952 of file Stmt.h.

Member Function Documentation

void clang::SwitchStmt::addSwitchCase ( SwitchCase SC)
inline
child_range clang::SwitchStmt::children ( )
inline

Definition at line 1013 of file Stmt.h.

static bool clang::SwitchStmt::classof ( const Stmt T)
inlinestatic

Definition at line 1017 of file Stmt.h.

const Stmt* clang::SwitchStmt::getBody ( ) const
inline
Stmt* clang::SwitchStmt::getBody ( )
inline

Definition at line 978 of file Stmt.h.

const Expr* clang::SwitchStmt::getCond ( ) const
inline
Expr* clang::SwitchStmt::getCond ( )
inline

Definition at line 976 of file Stmt.h.

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 826 of file Stmt.cpp.

References clang::DeclStmt::getSingleDecl().

Referenced by clang::CodeGen::CodeGenFunction::EmitSwitchStmt(), EvaluateSwitch(), and clang::ASTNodeImporter::VisitSwitchStmt().

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.

Definition at line 968 of file Stmt.h.

SourceLocation clang::SwitchStmt::getLocEnd ( ) const
inline

Definition at line 1008 of file Stmt.h.

SourceLocation clang::SwitchStmt::getLocStart ( ) const
inline

Definition at line 1007 of file Stmt.h.

const SwitchCase* clang::SwitchStmt::getSwitchCaseList ( ) const
inline
SwitchCase* clang::SwitchStmt::getSwitchCaseList ( )
inline

Definition at line 980 of file Stmt.h.

SourceLocation clang::SwitchStmt::getSwitchLoc ( ) const
inline

Definition at line 985 of file Stmt.h.

Referenced by clang::ASTNodeImporter::VisitSwitchStmt().

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

Referenced by clang::Sema::ActOnFinishSwitchStmt().

void clang::SwitchStmt::setBody ( Stmt S)
inline

Definition at line 979 of file Stmt.h.

References S.

Referenced by clang::Sema::ActOnFinishSwitchStmt(), and clang::ASTNodeImporter::VisitSwitchStmt().

void clang::SwitchStmt::setBody ( Stmt S,
SourceLocation  SL 
)
inline

Definition at line 988 of file Stmt.h.

References S.

void clang::SwitchStmt::setCond ( Expr E)
inline

Definition at line 977 of file Stmt.h.

References E.

void SwitchStmt::setConditionVariable ( const ASTContext C,
VarDecl V 
)
void clang::SwitchStmt::setSwitchCaseList ( SwitchCase SC)
inline

Set the case list for this switch statement.

Definition at line 983 of file Stmt.h.

Referenced by clang::ASTNodeImporter::VisitSwitchStmt().

void clang::SwitchStmt::setSwitchLoc ( SourceLocation  L)
inline

Definition at line 986 of file Stmt.h.

Referenced by clang::ASTNodeImporter::VisitSwitchStmt().


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