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