14 #ifndef LLVM_CLANG_AST_STMTCXX_H
15 #define LLVM_CLANG_AST_STMTCXX_H
21 #include "llvm/Support/Compiler.h"
38 :
Stmt(CXXCatchStmtClass), CatchLoc(catchLoc), ExceptionDecl(exDecl),
39 HandlerBlock(handlerBlock) {}
42 :
Stmt(CXXCatchStmtClass), ExceptionDecl(nullptr), HandlerBlock(nullptr) {}
46 return HandlerBlock->getLocEnd();
55 return T->getStmtClass() == CXXCatchStmtClass;
58 child_range
children() {
return child_range(&HandlerBlock, &HandlerBlock+1); }
71 CXXTryStmt(EmptyShell Empty,
unsigned numHandlers)
72 :
Stmt(CXXTryStmtClass), NumHandlers(numHandlers) { }
74 Stmt const *
const *getStmts()
const {
75 return reinterpret_cast<Stmt const * const*
>(
this + 1);
78 return reinterpret_cast<Stmt **
>(
this + 1);
86 unsigned numHandlers);
93 return getStmts()[NumHandlers]->getLocEnd();
97 return cast<CompoundStmt>(getStmts()[0]);
100 return cast<CompoundStmt>(getStmts()[0]);
105 return cast<CXXCatchStmt>(getStmts()[i + 1]);
108 return cast<CXXCatchStmt>(getStmts()[i + 1]);
112 return T->getStmtClass() == CXXTryStmtClass;
116 return child_range(getStmts(), getStmts() +
getNumHandlers() + 1);
130 enum { RANGE, BEGINEND, COND, INC, LOOPVAR, BODY, END };
152 return cast_or_null<DeclStmt>(SubExprs[BEGINEND]);
160 return cast<DeclStmt>(SubExprs[RANGE]);
163 return cast_or_null<DeclStmt>(SubExprs[BEGINEND]);
166 return cast_or_null<Expr>(SubExprs[COND]);
169 return cast_or_null<Expr>(SubExprs[INC]);
172 return cast<DeclStmt>(SubExprs[LOOPVAR]);
194 return SubExprs[BODY]->getLocEnd();
198 return T->getStmtClass() == CXXForRangeStmtClass;
203 return child_range(&SubExprs[0], &SubExprs[END]);
249 :
Stmt(MSDependentExistsStmtClass),
250 KeywordLoc(KeywordLoc), IsIfExists(IsIfExists),
251 QualifierLoc(QualifierLoc), NameInfo(NameInfo),
252 SubStmt(reinterpret_cast<
Stmt *>(SubStmt)) { }
282 return child_range(&SubStmt, &SubStmt+1);
286 return T->getStmtClass() == MSDependentExistsStmtClass;
void setRangeStmt(Stmt *S)
CXXCatchStmt(SourceLocation catchLoc, VarDecl *exDecl, Stmt *handlerBlock)
SourceLocation getLocStart() const LLVM_READONLY
CXXForRangeStmt(EmptyShell Empty)
static bool classof(const Stmt *T)
CXXCatchStmt * getHandler(unsigned i)
void setBeginEndStmt(Stmt *S)
CXXForRangeStmt(DeclStmt *Range, DeclStmt *BeginEnd, Expr *Cond, Expr *Inc, DeclStmt *LoopVar, Stmt *Body, SourceLocation FL, SourceLocation CL, SourceLocation RPL)
SourceLocation getLocEnd() const LLVM_READONLY
static bool classof(const Stmt *T)
SourceLocation getLocStart() const LLVM_READONLY
const DeclStmt * getBeginEndStmt() const
const Stmt * getBody() const
const Expr * getInc() const
CompoundStmt * getSubStmt() const
Retrieve the compound statement that will be included in the program only if the existence of the sym...
SourceLocation getLocStart() const LLVM_READONLY
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
void setRangeInit(Expr *E)
void setForLoc(SourceLocation Loc)
DeclarationNameInfo getNameInfo() const
Retrieve the name of the entity we're testing for, along with location information.
static bool classof(const Stmt *T)
Stmt * getHandlerBlock() const
static CXXTryStmt * Create(const ASTContext &C, SourceLocation tryLoc, Stmt *tryBlock, ArrayRef< Stmt * > handlers)
const CXXCatchStmt * getHandler(unsigned i) const
SourceLocation getEndLoc() const
SourceLocation getTryLoc() const
SourceLocation getLocEnd() const LLVM_READONLY
const DeclStmt * getLoopVarStmt() const
SourceLocation getKeywordLoc() const
Retrieve the location of the __if_exists or __if_not_exists keyword.
MSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, CompoundStmt *SubStmt)
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies this name, if any.
const DeclStmt * getRangeStmt() const
SourceLocation getLocEnd() const LLVM_READONLY
static bool classof(const Stmt *T)
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getForLoc() const
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name...
Reads an AST files chain containing the contents of a translation unit.
unsigned getNumHandlers() const
QualType getCaughtType() const
DeclStmt * getBeginEndStmt()
void setColonLoc(SourceLocation Loc)
void setRParenLoc(SourceLocation Loc)
DeclStmt * getRangeStmt()
const CompoundStmt * getTryBlock() const
VarDecl * getLoopVariable()
CompoundStmt * getTryBlock()
bool isIfNotExists() const
Determine whether this is an __if_exists statement.
CXXCatchStmt(EmptyShell Empty)
const Expr * getCond() const
void setLoopVarStmt(Stmt *S)
bool isIfExists() const
Determine whether this is an __if_exists statement.
SourceLocation getColonLoc() const
VarDecl * getExceptionDecl() const
DeclStmt * getLoopVarStmt()
SourceLocation getRParenLoc() const
SourceLocation getCatchLoc() const
SourceLocation getLocStart() const LLVM_READONLY