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