18 using namespace clang;
22 return ExceptionDecl->
getType();
29 Size += ((handlers.size() + 1) *
sizeof(
Stmt *));
32 return new (Mem)
CXXTryStmt(tryLoc, tryBlock, handlers);
36 unsigned numHandlers) {
38 Size += ((numHandlers + 1) *
sizeof(
Stmt *));
41 return new (Mem)
CXXTryStmt(Empty, numHandlers);
46 :
Stmt(CXXTryStmtClass), TryLoc(tryLoc), NumHandlers(handlers.size()) {
47 Stmt **Stmts =
reinterpret_cast<Stmt **
>(
this + 1);
49 std::copy(handlers.begin(), handlers.end(), Stmts + 1);
58 :
Stmt(CXXForRangeStmtClass), ForLoc(FL), CoawaitLoc(CAL),
ColonLoc(CL),
60 SubExprs[RANGE] = Range;
61 SubExprs[BEGINSTMT] = BeginStmt;
62 SubExprs[ENDSTMT] = EndStmt;
63 SubExprs[COND] = Cond;
65 SubExprs[LOOPVAR] = LoopVar;
66 SubExprs[BODY] = Body;
72 assert(RangeDecl &&
"for-range should have a single var decl");
82 assert(LV &&
"No loop variable in CXXForRangeStmt");
83 return cast<VarDecl>(LV);
93 CoroutineBodyStmt::FirstParamMove + Args.
ParamMoves.size());
100 unsigned NumParams) {
102 CoroutineBodyStmt::FirstParamMove + NumParams);
106 Result->NumParams = NumParams;
107 auto *ParamBegin =
Result->getStoredStmts() + SubStmt::FirstParamMove;
108 std::uninitialized_fill(ParamBegin, ParamBegin + NumParams,
109 static_cast<Stmt *>(
nullptr));
114 :
Stmt(CoroutineBodyStmtClass), NumParams(Args.
ParamMoves.size()) {
115 Stmt **SubStmts = getStoredStmts();
116 SubStmts[CoroutineBodyStmt::Body] = Args.
Body;
117 SubStmts[CoroutineBodyStmt::Promise] = Args.
Promise;
119 SubStmts[CoroutineBodyStmt::FinalSuspend] = Args.
FinalSuspend;
120 SubStmts[CoroutineBodyStmt::OnException] = Args.
OnException;
121 SubStmts[CoroutineBodyStmt::OnFallthrough] = Args.
OnFallthrough;
122 SubStmts[CoroutineBodyStmt::Allocate] = Args.
Allocate;
123 SubStmts[CoroutineBodyStmt::Deallocate] = Args.
Deallocate;
124 SubStmts[CoroutineBodyStmt::ReturnValue] = Args.
ReturnValue;
125 SubStmts[CoroutineBodyStmt::ResultDecl] = Args.
ResultDecl;
126 SubStmts[CoroutineBodyStmt::ReturnStmt] = Args.
ReturnStmt;
127 SubStmts[CoroutineBodyStmt::ReturnStmtOnAllocFailure] =
130 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.
VarDecl - An instance of this class is created to represent 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...
Expr - 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
CXXForRangeStmt(DeclStmt *Range, DeclStmt *Begin, DeclStmt *End, Expr *Cond, Expr *Inc, DeclStmt *LoopVar, Stmt *Body, SourceLocation FL, SourceLocation CAL, SourceLocation CL, SourceLocation RPL)
Dataflow Directional Tag Classes.
const Expr * getInit() const
const Decl * getSingleDecl() const
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 ':'.