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