18 using namespace clang;
22 return ExceptionDecl->
getType();
28 const size_t Size = totalSizeToAlloc<Stmt *>(handlers.size() + 1);
30 return new (Mem)
CXXTryStmt(tryLoc, tryBlock, handlers);
34 unsigned numHandlers) {
35 const size_t Size = totalSizeToAlloc<Stmt *>(numHandlers + 1);
37 return new (Mem)
CXXTryStmt(Empty, numHandlers);
42 :
Stmt(CXXTryStmtClass), TryLoc(tryLoc), NumHandlers(handlers.size()) {
43 Stmt **Stmts = getStmts();
45 std::copy(handlers.begin(), handlers.end(), Stmts + 1);
54 :
Stmt(CXXForRangeStmtClass), ForLoc(FL), CoawaitLoc(CAL),
ColonLoc(CL),
56 SubExprs[INIT] = Init;
57 SubExprs[RANGE] = Range;
58 SubExprs[BEGINSTMT] = BeginStmt;
59 SubExprs[ENDSTMT] = EndStmt;
60 SubExprs[COND] = Cond;
62 SubExprs[LOOPVAR] = LoopVar;
63 SubExprs[BODY] = Body;
69 assert(RangeDecl &&
"for-range should have a single var decl");
79 assert(LV &&
"No loop variable in CXXForRangeStmt");
80 return cast<VarDecl>(LV);
90 CoroutineBodyStmt::FirstParamMove + Args.
ParamMoves.size());
99 CoroutineBodyStmt::FirstParamMove + NumParams);
103 Result->NumParams = NumParams;
104 auto *ParamBegin =
Result->getStoredStmts() + SubStmt::FirstParamMove;
105 std::uninitialized_fill(ParamBegin, ParamBegin + NumParams,
106 static_cast<Stmt *>(
nullptr));
111 :
Stmt(CoroutineBodyStmtClass), NumParams(Args.
ParamMoves.size()) {
112 Stmt **SubStmts = getStoredStmts();
113 SubStmts[CoroutineBodyStmt::Body] = Args.
Body;
114 SubStmts[CoroutineBodyStmt::Promise] = Args.
Promise;
116 SubStmts[CoroutineBodyStmt::FinalSuspend] = Args.
FinalSuspend;
117 SubStmts[CoroutineBodyStmt::OnException] = Args.
OnException;
118 SubStmts[CoroutineBodyStmt::OnFallthrough] = Args.
OnFallthrough;
119 SubStmts[CoroutineBodyStmt::Allocate] = Args.
Allocate;
120 SubStmts[CoroutineBodyStmt::Deallocate] = Args.
Deallocate;
121 SubStmts[CoroutineBodyStmt::ReturnValue] = Args.
ReturnValue;
122 SubStmts[CoroutineBodyStmt::ResultDecl] = Args.
ResultDecl;
123 SubStmts[CoroutineBodyStmt::ReturnStmt] = Args.
ReturnStmt;
124 SubStmts[CoroutineBodyStmt::ReturnStmtOnAllocFailure] =
127 const_cast<Stmt **
>(getParamMoves().data()));
Defines the clang::ASTContext interface.
A (possibly-)qualified type.
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
Stmt - This represents one statement.
Decl - This represents one declaration (or definition), e.g.
Represents a variable declaration or definition.
Stmt(StmtClass SC, EmptyShell)
Construct an empty statement.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getCaughtType() const
Stmt * ReturnStmtOnAllocFailure
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
This represents one expression.
CXXTryStmt - A C++ try block, including all handlers.
The result type of a method or function.
static CoroutineBodyStmt * Create(const ASTContext &C, CtorArgs const &Args)
Encodes a location in the source.
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
ArrayRef< Stmt * > ParamMoves
A placeholder type used to construct an empty shell of a type, that will be filled in later (e...
void * Allocate(size_t Size, unsigned Align=8) const
Dataflow Directional Tag Classes.
const Expr * getInit() const
const Decl * getSingleDecl() const
CXXForRangeStmt(Stmt *InitStmt, DeclStmt *Range, DeclStmt *Begin, DeclStmt *End, Expr *Cond, Expr *Inc, DeclStmt *LoopVar, Stmt *Body, SourceLocation FL, SourceLocation CAL, SourceLocation CL, SourceLocation RPL)
Represents the body of a coroutine.
DeclStmt * getRangeStmt()
static CXXTryStmt * Create(const ASTContext &C, SourceLocation tryLoc, Stmt *tryBlock, ArrayRef< Stmt *> handlers)
VarDecl * getLoopVariable()
DeclStmt * getLoopVarStmt()
SourceLocation ColonLoc
Location of ':'.