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) {}
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]);
116 return child_range(getStmts(), getStmts() + getNumHandlers() + 1);
130 enum {
RANGE, BEGINSTMT, ENDSTMT, COND, INC, LOOPVAR, BODY, END };
148 Expr *getRangeInit();
150 const VarDecl *getLoopVariable()
const;
151 const Expr *getRangeInit()
const;
156 return cast_or_null<DeclStmt>(SubExprs[BEGINSTMT]);
165 return cast<DeclStmt>(SubExprs[
RANGE]);
168 return cast_or_null<DeclStmt>(SubExprs[BEGINSTMT]);
171 return cast_or_null<DeclStmt>(SubExprs[ENDSTMT]);
174 return cast_or_null<Expr>(SubExprs[COND]);
177 return cast_or_null<Expr>(SubExprs[INC]);
180 return cast<DeclStmt>(SubExprs[LOOPVAR]);
255 :
Stmt(MSDependentExistsStmtClass),
256 KeywordLoc(KeywordLoc), IsIfExists(IsIfExists),
257 QualifierLoc(QualifierLoc), NameInfo(NameInfo),
258 SubStmt(reinterpret_cast<
Stmt *>(SubStmt)) { }
314 ReturnStmtOnAllocFailure,
323 Stmt **getStoredStmts() {
return getTrailingObjects<Stmt *>(); }
325 Stmt *
const *getStoredStmts()
const {
return getTrailingObjects<Stmt *>(); }
332 Expr *InitialSuspend =
nullptr;
341 Stmt *ReturnStmtOnAllocFailure =
nullptr;
355 return getPromiseDecl()->getType()->isDependentType();
361 return getStoredStmts()[SubStmt::Body];
365 return getStoredStmts()[SubStmt::Promise];
368 return cast<VarDecl>(cast<DeclStmt>(getPromiseDeclStmt())->getSingleDecl());
372 return getStoredStmts()[SubStmt::InitSuspend];
375 return getStoredStmts()[SubStmt::FinalSuspend];
379 return getStoredStmts()[SubStmt::OnException];
382 return getStoredStmts()[SubStmt::OnFallthrough];
386 return cast_or_null<Expr>(getStoredStmts()[SubStmt::Allocate]);
389 return cast_or_null<Expr>(getStoredStmts()[SubStmt::Deallocate]);
392 return cast<Expr>(getStoredStmts()[SubStmt::ReturnValue]);
397 return getStoredStmts()[SubStmt::ReturnStmtOnAllocFailure];
400 return {getStoredStmts() + SubStmt::FirstParamMove, NumParams};
404 return getBody() ? getBody()->getLocStart()
405 : getPromiseDecl()->getLocStart();
408 return getBody() ? getBody()->getLocEnd() : getPromiseDecl()->getLocEnd();
413 getStoredStmts() + SubStmt::FirstParamMove + NumParams);
435 enum SubStmt { Operand, PromiseCall, Count };
436 Stmt *SubStmts[SubStmt::Count];
443 bool IsImplicit =
false)
444 :
Stmt(CoreturnStmtClass), CoreturnLoc(CoreturnLoc),
445 IsImplicit(IsImplicit) {
446 SubStmts[SubStmt::Operand] = Operand;
447 SubStmts[SubStmt::PromiseCall] = PromiseCall;
462 return static_cast<Expr*
>(SubStmts[PromiseCall]);
470 return getOperand() ? getOperand()->getLocEnd() :
getLocStart();
475 return child_range(SubStmts + SubStmt::PromiseCall,
476 SubStmts + SubStmt::Count);
477 return child_range(SubStmts, SubStmts + SubStmt::Count);
void setRangeStmt(Stmt *S)
CXXCatchStmt(SourceLocation catchLoc, VarDecl *exDecl, Stmt *handlerBlock)
SourceLocation getForLoc() const
SourceLocation getLocStart() const LLVM_READONLY
const DeclStmt * getRangeStmt() const
A (possibly-)qualified type.
const CompoundStmt * getTryBlock() const
CXXForRangeStmt(EmptyShell Empty)
static bool classof(const Stmt *T)
Represents a 'co_return' statement in the C++ Coroutines TS.
Stmt - This represents one statement.
CXXCatchStmt * getHandler(unsigned i)
Stmt * getHandlerBlock() const
DeclarationNameInfo getNameInfo() const
Retrieve the name of the entity we're testing for, along with location information.
Stmt * getPromiseDeclStmt() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies this name, if any.
llvm::iterator_range< child_iterator > child_range
static bool classof(const Stmt *T)
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getCoawaitLoc() const
Stmt * getExceptionHandler() const
Expr * getDeallocate() const
VarDecl - An instance of this class is created to represent a variable declaration or definition...
static bool classof(const Stmt *T)
SourceLocation getLocStart() const LLVM_READONLY
Stmt * getResultDecl() const
void setBeginStmt(Stmt *S)
Stmt(StmtClass SC, EmptyShell)
Construct an empty statement.
SourceLocation getKeywordLoc() const
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.
QualType getCaughtType() const
void setRangeInit(Expr *E)
const DeclStmt * getLoopVarStmt() const
void setIsImplicit(bool value=true)
VarDecl * getPromiseDecl() const
static bool classof(const Stmt *T)
SourceLocation getCatchLoc() const
ArrayRef< Stmt const * > getParamMoves() const
SourceLocation getRParenLoc() const
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
const CXXCatchStmt * getHandler(unsigned i) const
Stmt * getReturnStmt() const
CompoundStmt - This represents a group of statements like { stmt stmt }.
SourceLocation getLocStart() const LLVM_READONLY
CompoundStmt * getSubStmt() const
Retrieve the compound statement that will be included in the program only if the existence of the sym...
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getTryLoc() const
SourceLocation getLocEnd() const LLVM_READONLY
Expr - This represents one expression.
const FunctionProtoType * T
VarDecl * getExceptionDecl() const
bool isIfNotExists() const
Determine whether this is an __if_exists statement.
CXXTryStmt - A C++ try block, including all handlers.
SourceLocation getKeywordLoc() const
Retrieve the location of the __if_exists or __if_not_exists keyword.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
SourceLocation getLocStart() const LLVM_READONLY
MSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, CompoundStmt *SubStmt)
Encodes a location in the source.
unsigned getNumHandlers() const
SourceLocation getLocEnd() const LLVM_READONLY
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
SourceLocation getLocEnd() const LLVM_READONLY
static bool classof(const Stmt *T)
ArrayRef< Stmt * > ParamMoves
static bool classof(const Stmt *T)
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getLocEnd() const LLVM_READONLY
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name...
A placeholder type used to construct an empty shell of a type, that will be filled in later (e...
Dataflow Directional Tag Classes.
CoreturnStmt(SourceLocation CoreturnLoc, Stmt *Operand, Stmt *PromiseCall, bool IsImplicit=false)
Stmt * getReturnStmtOnAllocFailure() const
Expr * getAllocate() const
bool hasDependentPromiseType() const
Reads an AST files chain containing the contents of a translation unit.
Expr * getReturnValueInit() const
StmtClass getStmtClass() const
Expr * getOperand() const
Retrieve the operand of the 'co_return' statement.
Stmt * getInitSuspendStmt() const
bool isIfExists() const
Determine whether this is an __if_exists statement.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
Represents the body of a coroutine.
const Expr * getInc() const
const DeclStmt * getBeginStmt() const
DeclStmt * getRangeStmt()
const DeclStmt * getEndStmt() const
const Stmt * getBody() const
Expr * getPromiseCall() const
Retrieve the promise call that results from this 'co_return' statement.
Stmt * getFallthroughHandler() const
SourceLocation getColonLoc() const
CXXCatchStmt - This represents a C++ catch block.
CompoundStmt * getTryBlock()
CXXCatchStmt(EmptyShell Empty)
void setLoopVarStmt(Stmt *S)
Stmt * getBody() const
Retrieve the body of the coroutine as written.
SourceLocation getEndLoc() const
DeclStmt * getLoopVarStmt()
DeclStmt * getBeginStmt()
SourceLocation ColonLoc
Location of ':'.
const Expr * getCond() const
SourceLocation getLocStart() const LLVM_READONLY
Stmt * getFinalSuspendStmt() const
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.