21 return ExceptionDecl->
getType();
27 const size_t Size = totalSizeToAlloc<Stmt *>(handlers.size() + 1);
29 return new (Mem)
CXXTryStmt(tryLoc, tryBlock, handlers);
33 unsigned numHandlers) {
34 const size_t Size = totalSizeToAlloc<Stmt *>(numHandlers + 1);
36 return new (Mem)
CXXTryStmt(Empty, numHandlers);
41 :
Stmt(CXXTryStmtClass), TryLoc(tryLoc), NumHandlers(handlers.size()) {
42 Stmt **Stmts = getStmts();
44 std::copy(handlers.begin(), handlers.end(), Stmts + 1);
53 :
Stmt(CXXForRangeStmtClass), ForLoc(FL), CoawaitLoc(CAL), ColonLoc(CL),
55 SubExprs[INIT] = Init;
56 SubExprs[RANGE] = Range;
57 SubExprs[BEGINSTMT] = BeginStmt;
58 SubExprs[ENDSTMT] = EndStmt;
59 SubExprs[COND] = Cond;
61 SubExprs[LOOPVAR] = LoopVar;
62 SubExprs[BODY] = Body;
68 assert(RangeDecl &&
"for-range should have a single var decl");
78 assert(LV &&
"No loop variable in CXXForRangeStmt");
79 return cast<VarDecl>(LV);
88 std::size_t Size = totalSizeToAlloc<Stmt *>(
89 CoroutineBodyStmt::FirstParamMove + Args.
ParamMoves.size());
97 std::size_t Size = totalSizeToAlloc<Stmt *>(
98 CoroutineBodyStmt::FirstParamMove + NumParams);
102 Result->NumParams = NumParams;
103 auto *ParamBegin =
Result->getStoredStmts() + SubStmt::FirstParamMove;
104 std::uninitialized_fill(ParamBegin, ParamBegin + NumParams,
105 static_cast<Stmt *
>(
nullptr));
110 :
Stmt(CoroutineBodyStmtClass), NumParams(Args.ParamMoves.size()) {
111 Stmt **SubStmts = getStoredStmts();
112 SubStmts[CoroutineBodyStmt::Body] = Args.
Body;
113 SubStmts[CoroutineBodyStmt::Promise] = Args.
Promise;
115 SubStmts[CoroutineBodyStmt::FinalSuspend] = Args.
FinalSuspend;
116 SubStmts[CoroutineBodyStmt::OnException] = Args.
OnException;
117 SubStmts[CoroutineBodyStmt::OnFallthrough] = Args.
OnFallthrough;
118 SubStmts[CoroutineBodyStmt::Allocate] = Args.
Allocate;
119 SubStmts[CoroutineBodyStmt::Deallocate] = Args.
Deallocate;
120 SubStmts[CoroutineBodyStmt::ReturnValue] = Args.
ReturnValue;
121 SubStmts[CoroutineBodyStmt::ReturnStmt] = Args.
ReturnStmt;
122 SubStmts[CoroutineBodyStmt::ReturnStmtOnAllocFailure] =
Defines the clang::ASTContext interface.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getCaughtType() const
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
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)
DeclStmt * getLoopVarStmt()
DeclStmt * getRangeStmt()
VarDecl * getLoopVariable()
CXXTryStmt - A C++ try block, including all handlers.
static CXXTryStmt * Create(const ASTContext &C, SourceLocation tryLoc, Stmt *tryBlock, ArrayRef< Stmt * > handlers)
Represents the body of a coroutine.
static CoroutineBodyStmt * Create(const ASTContext &C, CtorArgs const &Args)
ArrayRef< Stmt const * > getParamMoves() const
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
const Decl * getSingleDecl() const
Decl - This represents one declaration (or definition), e.g.
This represents one expression.
A (possibly-)qualified type.
Encodes a location in the source.
Stmt - This represents one statement.
Represents a variable declaration or definition.
const Expr * getInit() const
@ C
Languages that the frontend can parse and compile.
@ Result
The result type of a method or function.
Stmt * ReturnStmtOnAllocFailure
ArrayRef< Stmt * > ParamMoves
A placeholder type used to construct an empty shell of a type, that will be filled in later (e....