clang 19.0.0git
StmtCXX.h
Go to the documentation of this file.
1//===--- StmtCXX.h - Classes for representing C++ statements ----*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the C++ statement AST node classes.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_AST_STMTCXX_H
14#define LLVM_CLANG_AST_STMTCXX_H
15
17#include "clang/AST/Expr.h"
19#include "clang/AST/Stmt.h"
20#include "llvm/Support/Compiler.h"
21
22namespace clang {
23
24class VarDecl;
25
26/// CXXCatchStmt - This represents a C++ catch block.
27///
28class CXXCatchStmt : public Stmt {
29 SourceLocation CatchLoc;
30 /// The exception-declaration of the type.
31 VarDecl *ExceptionDecl;
32 /// The handler block.
33 Stmt *HandlerBlock;
34
35public:
36 CXXCatchStmt(SourceLocation catchLoc, VarDecl *exDecl, Stmt *handlerBlock)
37 : Stmt(CXXCatchStmtClass), CatchLoc(catchLoc), ExceptionDecl(exDecl),
38 HandlerBlock(handlerBlock) {}
39
41 : Stmt(CXXCatchStmtClass), ExceptionDecl(nullptr), HandlerBlock(nullptr) {}
42
43 SourceLocation getBeginLoc() const LLVM_READONLY { return CatchLoc; }
44 SourceLocation getEndLoc() const LLVM_READONLY {
45 return HandlerBlock->getEndLoc();
46 }
47
48 SourceLocation getCatchLoc() const { return CatchLoc; }
49 VarDecl *getExceptionDecl() const { return ExceptionDecl; }
50 QualType getCaughtType() const;
51 Stmt *getHandlerBlock() const { return HandlerBlock; }
52
53 static bool classof(const Stmt *T) {
54 return T->getStmtClass() == CXXCatchStmtClass;
55 }
56
57 child_range children() { return child_range(&HandlerBlock, &HandlerBlock+1); }
58
60 return const_child_range(&HandlerBlock, &HandlerBlock + 1);
61 }
62
63 friend class ASTStmtReader;
64};
65
66/// CXXTryStmt - A C++ try block, including all handlers.
67///
68class CXXTryStmt final : public Stmt,
69 private llvm::TrailingObjects<CXXTryStmt, Stmt *> {
70
71 friend TrailingObjects;
72 friend class ASTStmtReader;
73
74 SourceLocation TryLoc;
75 unsigned NumHandlers;
76 size_t numTrailingObjects(OverloadToken<Stmt *>) const { return NumHandlers; }
77
78 CXXTryStmt(SourceLocation tryLoc, CompoundStmt *tryBlock,
79 ArrayRef<Stmt *> handlers);
80 CXXTryStmt(EmptyShell Empty, unsigned numHandlers)
81 : Stmt(CXXTryStmtClass), NumHandlers(numHandlers) { }
82
83 Stmt *const *getStmts() const { return getTrailingObjects<Stmt *>(); }
84 Stmt **getStmts() { return getTrailingObjects<Stmt *>(); }
85
86public:
87 static CXXTryStmt *Create(const ASTContext &C, SourceLocation tryLoc,
88 CompoundStmt *tryBlock, ArrayRef<Stmt *> handlers);
89
90 static CXXTryStmt *Create(const ASTContext &C, EmptyShell Empty,
91 unsigned numHandlers);
92
93 SourceLocation getBeginLoc() const LLVM_READONLY { return getTryLoc(); }
94
95 SourceLocation getTryLoc() const { return TryLoc; }
97 return getStmts()[NumHandlers]->getEndLoc();
98 }
99
101 return cast<CompoundStmt>(getStmts()[0]);
102 }
103 const CompoundStmt *getTryBlock() const {
104 return cast<CompoundStmt>(getStmts()[0]);
105 }
106
107 unsigned getNumHandlers() const { return NumHandlers; }
109 return cast<CXXCatchStmt>(getStmts()[i + 1]);
110 }
111 const CXXCatchStmt *getHandler(unsigned i) const {
112 return cast<CXXCatchStmt>(getStmts()[i + 1]);
113 }
114
115 static bool classof(const Stmt *T) {
116 return T->getStmtClass() == CXXTryStmtClass;
117 }
118
120 return child_range(getStmts(), getStmts() + getNumHandlers() + 1);
121 }
122
124 return const_child_range(getStmts(), getStmts() + getNumHandlers() + 1);
125 }
126};
127
128/// CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for
129/// statement, represented as 'for (range-declarator : range-expression)'
130/// or 'for (init-statement range-declarator : range-expression)'.
131///
132/// This is stored in a partially-desugared form to allow full semantic
133/// analysis of the constituent components. The original syntactic components
134/// can be extracted using getLoopVariable and getRangeInit.
135class CXXForRangeStmt : public Stmt {
136 SourceLocation ForLoc;
137 enum { INIT, RANGE, BEGINSTMT, ENDSTMT, COND, INC, LOOPVAR, BODY, END };
138 // SubExprs[RANGE] is an expression or declstmt.
139 // SubExprs[COND] and SubExprs[INC] are expressions.
140 Stmt *SubExprs[END];
141 SourceLocation CoawaitLoc;
142 SourceLocation ColonLoc;
143 SourceLocation RParenLoc;
144
145 friend class ASTStmtReader;
146public:
148 DeclStmt *End, Expr *Cond, Expr *Inc, DeclStmt *LoopVar,
149 Stmt *Body, SourceLocation FL, SourceLocation CAL,
151 CXXForRangeStmt(EmptyShell Empty) : Stmt(CXXForRangeStmtClass, Empty) { }
152
153 Stmt *getInit() { return SubExprs[INIT]; }
156
157 const Stmt *getInit() const { return SubExprs[INIT]; }
158 const VarDecl *getLoopVariable() const;
159 const Expr *getRangeInit() const;
160
161
162 DeclStmt *getRangeStmt() { return cast<DeclStmt>(SubExprs[RANGE]); }
164 return cast_or_null<DeclStmt>(SubExprs[BEGINSTMT]);
165 }
166 DeclStmt *getEndStmt() { return cast_or_null<DeclStmt>(SubExprs[ENDSTMT]); }
167 Expr *getCond() { return cast_or_null<Expr>(SubExprs[COND]); }
168 Expr *getInc() { return cast_or_null<Expr>(SubExprs[INC]); }
169 DeclStmt *getLoopVarStmt() { return cast<DeclStmt>(SubExprs[LOOPVAR]); }
170 Stmt *getBody() { return SubExprs[BODY]; }
171
172 const DeclStmt *getRangeStmt() const {
173 return cast<DeclStmt>(SubExprs[RANGE]);
174 }
175 const DeclStmt *getBeginStmt() const {
176 return cast_or_null<DeclStmt>(SubExprs[BEGINSTMT]);
177 }
178 const DeclStmt *getEndStmt() const {
179 return cast_or_null<DeclStmt>(SubExprs[ENDSTMT]);
180 }
181 const Expr *getCond() const {
182 return cast_or_null<Expr>(SubExprs[COND]);
183 }
184 const Expr *getInc() const {
185 return cast_or_null<Expr>(SubExprs[INC]);
186 }
187 const DeclStmt *getLoopVarStmt() const {
188 return cast<DeclStmt>(SubExprs[LOOPVAR]);
189 }
190 const Stmt *getBody() const { return SubExprs[BODY]; }
191
192 void setInit(Stmt *S) { SubExprs[INIT] = S; }
193 void setRangeInit(Expr *E) { SubExprs[RANGE] = reinterpret_cast<Stmt*>(E); }
194 void setRangeStmt(Stmt *S) { SubExprs[RANGE] = S; }
195 void setBeginStmt(Stmt *S) { SubExprs[BEGINSTMT] = S; }
196 void setEndStmt(Stmt *S) { SubExprs[ENDSTMT] = S; }
197 void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt*>(E); }
198 void setInc(Expr *E) { SubExprs[INC] = reinterpret_cast<Stmt*>(E); }
199 void setLoopVarStmt(Stmt *S) { SubExprs[LOOPVAR] = S; }
200 void setBody(Stmt *S) { SubExprs[BODY] = S; }
201
202 SourceLocation getForLoc() const { return ForLoc; }
203 SourceLocation getCoawaitLoc() const { return CoawaitLoc; }
204 SourceLocation getColonLoc() const { return ColonLoc; }
205 SourceLocation getRParenLoc() const { return RParenLoc; }
206
207 SourceLocation getBeginLoc() const LLVM_READONLY { return ForLoc; }
208 SourceLocation getEndLoc() const LLVM_READONLY {
209 return SubExprs[BODY]->getEndLoc();
210 }
211
212 static bool classof(const Stmt *T) {
213 return T->getStmtClass() == CXXForRangeStmtClass;
214 }
215
216 // Iterators
218 return child_range(&SubExprs[0], &SubExprs[END]);
219 }
220
222 return const_child_range(&SubExprs[0], &SubExprs[END]);
223 }
224};
225
226/// Representation of a Microsoft __if_exists or __if_not_exists
227/// statement with a dependent name.
228///
229/// The __if_exists statement can be used to include a sequence of statements
230/// in the program only when a particular dependent name does not exist. For
231/// example:
232///
233/// \code
234/// template<typename T>
235/// void call_foo(T &t) {
236/// __if_exists (T::foo) {
237/// t.foo(); // okay: only called when T::foo exists.
238/// }
239/// }
240/// \endcode
241///
242/// Similarly, the __if_not_exists statement can be used to include the
243/// statements when a particular name does not exist.
244///
245/// Note that this statement only captures __if_exists and __if_not_exists
246/// statements whose name is dependent. All non-dependent cases are handled
247/// directly in the parser, so that they don't introduce a new scope. Clang
248/// introduces scopes in the dependent case to keep names inside the compound
249/// statement from leaking out into the surround statements, which would
250/// compromise the template instantiation model. This behavior differs from
251/// Visual C++ (which never introduces a scope), but is a fairly reasonable
252/// approximation of the VC++ behavior.
254 SourceLocation KeywordLoc;
255 bool IsIfExists;
256 NestedNameSpecifierLoc QualifierLoc;
257 DeclarationNameInfo NameInfo;
258 Stmt *SubStmt;
259
260 friend class ASTReader;
261 friend class ASTStmtReader;
262
263public:
264 MSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists,
265 NestedNameSpecifierLoc QualifierLoc,
266 DeclarationNameInfo NameInfo,
267 CompoundStmt *SubStmt)
268 : Stmt(MSDependentExistsStmtClass),
269 KeywordLoc(KeywordLoc), IsIfExists(IsIfExists),
270 QualifierLoc(QualifierLoc), NameInfo(NameInfo),
271 SubStmt(reinterpret_cast<Stmt *>(SubStmt)) { }
272
273 /// Retrieve the location of the __if_exists or __if_not_exists
274 /// keyword.
275 SourceLocation getKeywordLoc() const { return KeywordLoc; }
276
277 /// Determine whether this is an __if_exists statement.
278 bool isIfExists() const { return IsIfExists; }
279
280 /// Determine whether this is an __if_exists statement.
281 bool isIfNotExists() const { return !IsIfExists; }
282
283 /// Retrieve the nested-name-specifier that qualifies this name, if
284 /// any.
285 NestedNameSpecifierLoc getQualifierLoc() const { return QualifierLoc; }
286
287 /// Retrieve the name of the entity we're testing for, along with
288 /// location information
289 DeclarationNameInfo getNameInfo() const { return NameInfo; }
290
291 /// Retrieve the compound statement that will be included in the
292 /// program only if the existence of the symbol matches the initial keyword.
294 return reinterpret_cast<CompoundStmt *>(SubStmt);
295 }
296
297 SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
298 SourceLocation getEndLoc() const LLVM_READONLY {
299 return SubStmt->getEndLoc();
300 }
301
303 return child_range(&SubStmt, &SubStmt+1);
304 }
305
307 return const_child_range(&SubStmt, &SubStmt + 1);
308 }
309
310 static bool classof(const Stmt *T) {
311 return T->getStmtClass() == MSDependentExistsStmtClass;
312 }
313};
314
315/// Represents the body of a coroutine. This wraps the normal function
316/// body and holds the additional semantic context required to set up and tear
317/// down the coroutine frame.
319 : public Stmt,
320 private llvm::TrailingObjects<CoroutineBodyStmt, Stmt *> {
321 enum SubStmt {
322 Body, ///< The body of the coroutine.
323 Promise, ///< The promise statement.
324 InitSuspend, ///< The initial suspend statement, run before the body.
325 FinalSuspend, ///< The final suspend statement, run after the body.
326 OnException, ///< Handler for exceptions thrown in the body.
327 OnFallthrough, ///< Handler for control flow falling off the body.
328 Allocate, ///< Coroutine frame memory allocation.
329 Deallocate, ///< Coroutine frame memory deallocation.
330 ResultDecl, ///< Declaration holding the result of get_return_object.
331 ReturnValue, ///< Return value for thunk function: p.get_return_object().
332 ReturnStmt, ///< Return statement for the thunk function.
333 ReturnStmtOnAllocFailure, ///< Return statement if allocation failed.
334 FirstParamMove ///< First offset for move construction of parameter copies.
335 };
336 unsigned NumParams;
337
338 friend class ASTStmtReader;
339 friend class ASTReader;
340 friend TrailingObjects;
341
342 Stmt **getStoredStmts() { return getTrailingObjects<Stmt *>(); }
343
344 Stmt *const *getStoredStmts() const { return getTrailingObjects<Stmt *>(); }
345
346public:
347
348 struct CtorArgs {
349 Stmt *Body = nullptr;
350 Stmt *Promise = nullptr;
352 Expr *FinalSuspend = nullptr;
353 Stmt *OnException = nullptr;
354 Stmt *OnFallthrough = nullptr;
355 Expr *Allocate = nullptr;
356 Expr *Deallocate = nullptr;
357 Stmt *ResultDecl = nullptr;
358 Expr *ReturnValue = nullptr;
359 Stmt *ReturnStmt = nullptr;
362 };
363
364private:
365
366 CoroutineBodyStmt(CtorArgs const& Args);
367
368public:
369 static CoroutineBodyStmt *Create(const ASTContext &C, CtorArgs const &Args);
371 unsigned NumParams);
372
375 }
376
377 /// Retrieve the body of the coroutine as written. This will be either
378 /// a CompoundStmt. If the coroutine is in function-try-block, we will
379 /// wrap the CXXTryStmt into a CompoundStmt to keep consistency.
381 return cast<CompoundStmt>(getStoredStmts()[SubStmt::Body]);
382 }
383
385 return getStoredStmts()[SubStmt::Promise];
386 }
388 return cast<VarDecl>(cast<DeclStmt>(getPromiseDeclStmt())->getSingleDecl());
389 }
390
392 return getStoredStmts()[SubStmt::InitSuspend];
393 }
395 return getStoredStmts()[SubStmt::FinalSuspend];
396 }
397
399 return getStoredStmts()[SubStmt::OnException];
400 }
402 return getStoredStmts()[SubStmt::OnFallthrough];
403 }
404
405 Expr *getAllocate() const {
406 return cast_or_null<Expr>(getStoredStmts()[SubStmt::Allocate]);
407 }
409 return cast_or_null<Expr>(getStoredStmts()[SubStmt::Deallocate]);
410 }
411 Stmt *getResultDecl() const { return getStoredStmts()[SubStmt::ResultDecl]; }
413 return cast<Expr>(getStoredStmts()[SubStmt::ReturnValue]);
414 }
416 auto *RS = dyn_cast_or_null<clang::ReturnStmt>(getReturnStmt());
417 return RS ? RS->getRetValue() : nullptr;
418 }
419 Stmt *getReturnStmt() const { return getStoredStmts()[SubStmt::ReturnStmt]; }
421 return getStoredStmts()[SubStmt::ReturnStmtOnAllocFailure];
422 }
424 return {getStoredStmts() + SubStmt::FirstParamMove, NumParams};
425 }
426
427 SourceLocation getBeginLoc() const LLVM_READONLY {
428 return getBody() ? getBody()->getBeginLoc()
430 }
431 SourceLocation getEndLoc() const LLVM_READONLY {
432 return getBody() ? getBody()->getEndLoc() : getPromiseDecl()->getEndLoc();
433 }
434
436 return child_range(getStoredStmts(),
437 getStoredStmts() + SubStmt::FirstParamMove + NumParams);
438 }
439
441 return const_child_range(getStoredStmts(), getStoredStmts() +
442 SubStmt::FirstParamMove +
443 NumParams);
444 }
445
447 return child_range(getStoredStmts() + SubStmt::Body + 1,
448 getStoredStmts() + SubStmt::FirstParamMove + NumParams);
449 }
450
452 return const_child_range(getStoredStmts() + SubStmt::Body + 1,
453 getStoredStmts() + SubStmt::FirstParamMove +
454 NumParams);
455 }
456
457 static bool classof(const Stmt *T) {
458 return T->getStmtClass() == CoroutineBodyStmtClass;
459 }
460};
461
462/// Represents a 'co_return' statement in the C++ Coroutines TS.
463///
464/// This statament models the initialization of the coroutine promise
465/// (encapsulating the eventual notional return value) from an expression
466/// (or braced-init-list), followed by termination of the coroutine.
467///
468/// This initialization is modeled by the evaluation of the operand
469/// followed by a call to one of:
470/// <promise>.return_value(<operand>)
471/// <promise>.return_void()
472/// which we name the "promise call".
473class CoreturnStmt : public Stmt {
474 SourceLocation CoreturnLoc;
475
476 enum SubStmt { Operand, PromiseCall, Count };
477 Stmt *SubStmts[SubStmt::Count];
478
479 bool IsImplicit : 1;
480
481 friend class ASTStmtReader;
482public:
483 CoreturnStmt(SourceLocation CoreturnLoc, Stmt *Operand, Stmt *PromiseCall,
484 bool IsImplicit = false)
485 : Stmt(CoreturnStmtClass), CoreturnLoc(CoreturnLoc),
486 IsImplicit(IsImplicit) {
487 SubStmts[SubStmt::Operand] = Operand;
488 SubStmts[SubStmt::PromiseCall] = PromiseCall;
489 }
490
492
493 SourceLocation getKeywordLoc() const { return CoreturnLoc; }
494
495 /// Retrieve the operand of the 'co_return' statement. Will be nullptr
496 /// if none was specified.
497 Expr *getOperand() const { return static_cast<Expr*>(SubStmts[Operand]); }
498
499 /// Retrieve the promise call that results from this 'co_return'
500 /// statement. Will be nullptr if either the coroutine has not yet been
501 /// finalized or the coroutine has no eventual return type.
503 return static_cast<Expr*>(SubStmts[PromiseCall]);
504 }
505
506 bool isImplicit() const { return IsImplicit; }
507 void setIsImplicit(bool value = true) { IsImplicit = value; }
508
509 SourceLocation getBeginLoc() const LLVM_READONLY { return CoreturnLoc; }
510 SourceLocation getEndLoc() const LLVM_READONLY {
511 return getOperand() ? getOperand()->getEndLoc() : getBeginLoc();
512 }
513
515 return child_range(SubStmts, SubStmts + SubStmt::Count);
516 }
517
519 return const_child_range(SubStmts, SubStmts + SubStmt::Count);
520 }
521
522 static bool classof(const Stmt *T) {
523 return T->getStmtClass() == CoreturnStmtClass;
524 }
525};
526
527} // end namespace clang
528
529#endif
SourceRange Range
Definition: SemaObjC.cpp:757
SourceLocation Begin
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:185
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:366
CXXCatchStmt - This represents a C++ catch block.
Definition: StmtCXX.h:28
SourceLocation getEndLoc() const LLVM_READONLY
Definition: StmtCXX.h:44
CXXCatchStmt(SourceLocation catchLoc, VarDecl *exDecl, Stmt *handlerBlock)
Definition: StmtCXX.h:36
SourceLocation getCatchLoc() const
Definition: StmtCXX.h:48
Stmt * getHandlerBlock() const
Definition: StmtCXX.h:51
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: StmtCXX.h:43
CXXCatchStmt(EmptyShell Empty)
Definition: StmtCXX.h:40
static bool classof(const Stmt *T)
Definition: StmtCXX.h:53
child_range children()
Definition: StmtCXX.h:57
const_child_range children() const
Definition: StmtCXX.h:59
VarDecl * getExceptionDecl() const
Definition: StmtCXX.h:49
QualType getCaughtType() const
Definition: StmtCXX.cpp:19
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Definition: StmtCXX.h:135
void setLoopVarStmt(Stmt *S)
Definition: StmtCXX.h:199
void setRangeStmt(Stmt *S)
Definition: StmtCXX.h:194
DeclStmt * getBeginStmt()
Definition: StmtCXX.h:163
DeclStmt * getLoopVarStmt()
Definition: StmtCXX.h:169
DeclStmt * getEndStmt()
Definition: StmtCXX.h:166
const DeclStmt * getRangeStmt() const
Definition: StmtCXX.h:172
SourceLocation getForLoc() const
Definition: StmtCXX.h:202
const DeclStmt * getEndStmt() const
Definition: StmtCXX.h:178
void setEndStmt(Stmt *S)
Definition: StmtCXX.h:196
DeclStmt * getRangeStmt()
Definition: StmtCXX.h:162
const DeclStmt * getBeginStmt() const
Definition: StmtCXX.h:175
void setInc(Expr *E)
Definition: StmtCXX.h:198
const Expr * getCond() const
Definition: StmtCXX.h:181
SourceLocation getRParenLoc() const
Definition: StmtCXX.h:205
const Expr * getInc() const
Definition: StmtCXX.h:184
SourceLocation getColonLoc() const
Definition: StmtCXX.h:204
void setBeginStmt(Stmt *S)
Definition: StmtCXX.h:195
const_child_range children() const
Definition: StmtCXX.h:221
VarDecl * getLoopVariable()
Definition: StmtCXX.cpp:77
void setInit(Stmt *S)
Definition: StmtCXX.h:192
SourceLocation getEndLoc() const LLVM_READONLY
Definition: StmtCXX.h:208
void setBody(Stmt *S)
Definition: StmtCXX.h:200
CXXForRangeStmt(EmptyShell Empty)
Definition: StmtCXX.h:151
const Stmt * getBody() const
Definition: StmtCXX.h:190
void setCond(Expr *E)
Definition: StmtCXX.h:197
SourceLocation getCoawaitLoc() const
Definition: StmtCXX.h:203
static bool classof(const Stmt *T)
Definition: StmtCXX.h:212
const DeclStmt * getLoopVarStmt() const
Definition: StmtCXX.h:187
void setRangeInit(Expr *E)
Definition: StmtCXX.h:193
child_range children()
Definition: StmtCXX.h:217
const Stmt * getInit() const
Definition: StmtCXX.h:157
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: StmtCXX.h:207
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:69
SourceLocation getTryLoc() const
Definition: StmtCXX.h:95
const CXXCatchStmt * getHandler(unsigned i) const
Definition: StmtCXX.h:111
static bool classof(const Stmt *T)
Definition: StmtCXX.h:115
const_child_range children() const
Definition: StmtCXX.h:123
CXXCatchStmt * getHandler(unsigned i)
Definition: StmtCXX.h:108
unsigned getNumHandlers() const
Definition: StmtCXX.h:107
child_range children()
Definition: StmtCXX.h:119
SourceLocation getEndLoc() const
Definition: StmtCXX.h:96
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: StmtCXX.h:93
const CompoundStmt * getTryBlock() const
Definition: StmtCXX.h:103
CompoundStmt * getTryBlock()
Definition: StmtCXX.h:100
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1606
SourceLocation getBeginLoc() const
Definition: Stmt.h:1735
SourceLocation getEndLoc() const
Definition: Stmt.h:1736
Represents a 'co_return' statement in the C++ Coroutines TS.
Definition: StmtCXX.h:473
Expr * getOperand() const
Retrieve the operand of the 'co_return' statement.
Definition: StmtCXX.h:497
void setIsImplicit(bool value=true)
Definition: StmtCXX.h:507
Expr * getPromiseCall() const
Retrieve the promise call that results from this 'co_return' statement.
Definition: StmtCXX.h:502
SourceLocation getEndLoc() const LLVM_READONLY
Definition: StmtCXX.h:510
CoreturnStmt(EmptyShell)
Definition: StmtCXX.h:491
child_range children()
Definition: StmtCXX.h:514
bool isImplicit() const
Definition: StmtCXX.h:506
SourceLocation getKeywordLoc() const
Definition: StmtCXX.h:493
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: StmtCXX.h:509
CoreturnStmt(SourceLocation CoreturnLoc, Stmt *Operand, Stmt *PromiseCall, bool IsImplicit=false)
Definition: StmtCXX.h:483
static bool classof(const Stmt *T)
Definition: StmtCXX.h:522
const_child_range children() const
Definition: StmtCXX.h:518
Represents the body of a coroutine.
Definition: StmtCXX.h:320
CompoundStmt * getBody() const
Retrieve the body of the coroutine as written.
Definition: StmtCXX.h:380
static bool classof(const Stmt *T)
Definition: StmtCXX.h:457
Stmt * getReturnStmtOnAllocFailure() const
Definition: StmtCXX.h:420
Expr * getReturnValueInit() const
Definition: StmtCXX.h:412
Stmt * getReturnStmt() const
Definition: StmtCXX.h:419
bool hasDependentPromiseType() const
Definition: StmtCXX.h:373
Stmt * getResultDecl() const
Definition: StmtCXX.h:411
child_range childrenExclBody()
Definition: StmtCXX.h:446
Stmt * getInitSuspendStmt() const
Definition: StmtCXX.h:391
Expr * getAllocate() const
Definition: StmtCXX.h:405
Stmt * getPromiseDeclStmt() const
Definition: StmtCXX.h:384
VarDecl * getPromiseDecl() const
Definition: StmtCXX.h:387
Expr * getDeallocate() const
Definition: StmtCXX.h:408
Stmt * getFallthroughHandler() const
Definition: StmtCXX.h:401
Stmt * getExceptionHandler() const
Definition: StmtCXX.h:398
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: StmtCXX.h:427
Expr * getReturnValue() const
Definition: StmtCXX.h:415
SourceLocation getEndLoc() const LLVM_READONLY
Definition: StmtCXX.h:431
child_range children()
Definition: StmtCXX.h:435
Stmt * getFinalSuspendStmt() const
Definition: StmtCXX.h:394
const_child_range children() const
Definition: StmtCXX.h:440
ArrayRef< Stmt const * > getParamMoves() const
Definition: StmtCXX.h:423
const_child_range childrenExclBody() const
Definition: StmtCXX.h:451
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition: Stmt.h:1497
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclBase.h:441
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Decl.h:822
This represents one expression.
Definition: Expr.h:110
Representation of a Microsoft __if_exists or __if_not_exists statement with a dependent name.
Definition: StmtCXX.h:253
bool isIfExists() const
Determine whether this is an __if_exists statement.
Definition: StmtCXX.h:278
DeclarationNameInfo getNameInfo() const
Retrieve the name of the entity we're testing for, along with location information.
Definition: StmtCXX.h:289
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies this name, if any.
Definition: StmtCXX.h:285
CompoundStmt * getSubStmt() const
Retrieve the compound statement that will be included in the program only if the existence of the sym...
Definition: StmtCXX.h:293
SourceLocation getEndLoc() const LLVM_READONLY
Definition: StmtCXX.h:298
SourceLocation getKeywordLoc() const
Retrieve the location of the __if_exists or __if_not_exists keyword.
Definition: StmtCXX.h:275
child_range children()
Definition: StmtCXX.h:302
static bool classof(const Stmt *T)
Definition: StmtCXX.h:310
bool isIfNotExists() const
Determine whether this is an __if_exists statement.
Definition: StmtCXX.h:281
const_child_range children() const
Definition: StmtCXX.h:306
MSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, CompoundStmt *SubStmt)
Definition: StmtCXX.h:264
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: StmtCXX.h:297
A C++ nested-name-specifier augmented with source location information.
A (possibly-)qualified type.
Definition: Type.h:940
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Definition: Stmt.h:3019
Encodes a location in the source.
Stmt - This represents one statement.
Definition: Stmt.h:84
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.cpp:350
llvm::iterator_range< child_iterator > child_range
Definition: Stmt.h:1447
Stmt()=delete
llvm::iterator_range< const_child_iterator > const_child_range
Definition: Stmt.h:1448
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:2669
QualType getType() const
Definition: Decl.h:717
Represents a variable declaration or definition.
Definition: Decl.h:918
The JSON file list parser is used to communicate input to InstallAPI.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
const FunctionProtoType * T
ArrayRef< Stmt * > ParamMoves
Definition: StmtCXX.h:361
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
A placeholder type used to construct an empty shell of a type, that will be filled in later (e....
Definition: Stmt.h:1298