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