clang  8.0.0svn
Stmt.h
Go to the documentation of this file.
1 //===- Stmt.h - Classes for representing 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 Stmt interface and subclasses.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_AST_STMT_H
15 #define LLVM_CLANG_AST_STMT_H
16 
17 #include "clang/AST/DeclGroup.h"
18 #include "clang/AST/StmtIterator.h"
21 #include "clang/Basic/LLVM.h"
23 #include "llvm/ADT/ArrayRef.h"
24 #include "llvm/ADT/PointerIntPair.h"
25 #include "llvm/ADT/StringRef.h"
26 #include "llvm/ADT/iterator.h"
27 #include "llvm/ADT/iterator_range.h"
28 #include "llvm/Support/Casting.h"
29 #include "llvm/Support/Compiler.h"
30 #include "llvm/Support/ErrorHandling.h"
31 #include <algorithm>
32 #include <cassert>
33 #include <cstddef>
34 #include <iterator>
35 #include <string>
36 
37 namespace llvm {
38 
39 class FoldingSetNodeID;
40 
41 } // namespace llvm
42 
43 namespace clang {
44 
45 class ASTContext;
46 class Attr;
47 class CapturedDecl;
48 class Decl;
49 class Expr;
50 class LabelDecl;
51 class ODRHash;
52 class PrinterHelper;
53 struct PrintingPolicy;
54 class RecordDecl;
55 class SourceManager;
56 class StringLiteral;
57 class Token;
58 class VarDecl;
59 
60 //===----------------------------------------------------------------------===//
61 // AST classes for statements.
62 //===----------------------------------------------------------------------===//
63 
64 /// Stmt - This represents one statement.
65 ///
66 class alignas(void *) Stmt {
67 public:
68  enum StmtClass {
69  NoStmtClass = 0,
70 #define STMT(CLASS, PARENT) CLASS##Class,
71 #define STMT_RANGE(BASE, FIRST, LAST) \
72  first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class,
73 #define LAST_STMT_RANGE(BASE, FIRST, LAST) \
74  first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class
75 #define ABSTRACT_STMT(STMT)
76 #include "clang/AST/StmtNodes.inc"
77  };
78 
79  // Make vanilla 'new' and 'delete' illegal for Stmts.
80 protected:
81  friend class ASTStmtReader;
82  friend class ASTStmtWriter;
83 
84  void *operator new(size_t bytes) noexcept {
85  llvm_unreachable("Stmts cannot be allocated with regular 'new'.");
86  }
87 
88  void operator delete(void *data) noexcept {
89  llvm_unreachable("Stmts cannot be released with regular 'delete'.");
90  }
91 
92  class StmtBitfields {
93  friend class Stmt;
94 
95  /// The statement class.
96  unsigned sClass : 8;
97  };
98  enum { NumStmtBits = 8 };
99 
101  friend class CompoundStmt;
102 
103  unsigned : NumStmtBits;
104 
105  unsigned NumStmts : 32 - NumStmtBits;
106  };
107 
109  friend class IfStmt;
110 
111  unsigned : NumStmtBits;
112 
113  unsigned IsConstexpr : 1;
114  };
115 
117  friend class ASTStmtReader; // deserialization
118  friend class AtomicExpr; // ctor
119  friend class BlockDeclRefExpr; // ctor
120  friend class CallExpr; // ctor
121  friend class CXXConstructExpr; // ctor
122  friend class CXXDependentScopeMemberExpr; // ctor
123  friend class CXXNewExpr; // ctor
124  friend class CXXUnresolvedConstructExpr; // ctor
125  friend class DeclRefExpr; // computeDependence
126  friend class DependentScopeDeclRefExpr; // ctor
127  friend class DesignatedInitExpr; // ctor
128  friend class Expr;
129  friend class InitListExpr; // ctor
130  friend class ObjCArrayLiteral; // ctor
131  friend class ObjCDictionaryLiteral; // ctor
132  friend class ObjCMessageExpr; // ctor
133  friend class OffsetOfExpr; // ctor
134  friend class OpaqueValueExpr; // ctor
135  friend class OverloadExpr; // ctor
136  friend class ParenListExpr; // ctor
137  friend class PseudoObjectExpr; // ctor
138  friend class ShuffleVectorExpr; // ctor
139 
140  unsigned : NumStmtBits;
141 
142  unsigned ValueKind : 2;
143  unsigned ObjectKind : 3;
144  unsigned TypeDependent : 1;
145  unsigned ValueDependent : 1;
146  unsigned InstantiationDependent : 1;
147  unsigned ContainsUnexpandedParameterPack : 1;
148  };
149  enum { NumExprBits = 17 };
150 
152  friend class CharacterLiteral;
153 
154  unsigned : NumExprBits;
155 
156  unsigned Kind : 3;
157  };
158 
165  PPCDoubleDouble
166  };
167 
169  friend class FloatingLiteral;
170 
171  unsigned : NumExprBits;
172 
173  unsigned Semantics : 3; // Provides semantics for APFloat construction
174  unsigned IsExact : 1;
175  };
176 
179 
180  unsigned : NumExprBits;
181 
182  unsigned Kind : 2;
183  unsigned IsType : 1; // true if operand is a type, false if an expression.
184  };
185 
187  friend class ASTStmtReader; // deserialization
188  friend class DeclRefExpr;
189 
190  unsigned : NumExprBits;
191 
192  unsigned HasQualifier : 1;
193  unsigned HasTemplateKWAndArgsInfo : 1;
194  unsigned HasFoundDecl : 1;
195  unsigned HadMultipleCandidates : 1;
196  unsigned RefersToEnclosingVariableOrCapture : 1;
197  };
198 
200  friend class CastExpr;
201  friend class ImplicitCastExpr;
202 
203  unsigned : NumExprBits;
204 
205  unsigned Kind : 6;
206  unsigned PartOfExplicitCast : 1; // Only set for ImplicitCastExpr.
207  unsigned BasePathIsEmpty : 1;
208  };
209 
211  friend class CallExpr;
212 
213  unsigned : NumExprBits;
214 
215  unsigned NumPreArgs : 1;
216  };
217 
219  friend class ASTStmtReader; // deserialization
220  friend class ExprWithCleanups;
221 
222  unsigned : NumExprBits;
223 
224  // When false, it must not have side effects.
225  unsigned CleanupsHaveSideEffects : 1;
226 
227  unsigned NumObjects : 32 - 1 - NumExprBits;
228  };
229 
231  friend class ASTStmtReader; // deserialization
232  friend class PseudoObjectExpr;
233 
234  unsigned : NumExprBits;
235 
236  // These don't need to be particularly wide, because they're
237  // strictly limited by the forms of expressions we permit.
238  unsigned NumSubExprs : 8;
239  unsigned ResultIndex : 32 - 8 - NumExprBits;
240  };
241 
243  friend class OpaqueValueExpr;
244 
245  unsigned : NumExprBits;
246 
247  /// The OVE is a unique semantic reference to its source expressio if this
248  /// bit is set to true.
249  unsigned IsUnique : 1;
250  };
251 
254 
255  unsigned : NumExprBits;
256 
257  unsigned ShouldCopy : 1;
258  };
259 
261  friend class InitListExpr;
262 
263  unsigned : NumExprBits;
264 
265  /// Whether this initializer list originally had a GNU array-range
266  /// designator in it. This is a temporary marker used by CodeGen.
267  unsigned HadArrayRangeDesignator : 1;
268  };
269 
271  friend class ASTStmtReader;
272  friend class ASTStmtWriter;
273  friend class TypeTraitExpr;
274 
275  unsigned : NumExprBits;
276 
277  /// The kind of type trait, which is a value of a TypeTrait enumerator.
278  unsigned Kind : 8;
279 
280  /// If this expression is not value-dependent, this indicates whether
281  /// the trait evaluated true or false.
282  unsigned Value : 1;
283 
284  /// The number of arguments to this type trait.
285  unsigned NumArgs : 32 - 8 - 1 - NumExprBits;
286  };
287 
289  friend class CoawaitExpr;
290 
291  unsigned : NumExprBits;
292 
293  unsigned IsImplicit : 1;
294  };
295 
296  union {
314  };
315 
316 public:
317  // Only allow allocation of Stmts using the allocator in ASTContext
318  // or by doing a placement new.
319  void* operator new(size_t bytes, const ASTContext& C,
320  unsigned alignment = 8);
321 
322  void* operator new(size_t bytes, const ASTContext* C,
323  unsigned alignment = 8) {
324  return operator new(bytes, *C, alignment);
325  }
326 
327  void *operator new(size_t bytes, void *mem) noexcept { return mem; }
328 
329  void operator delete(void *, const ASTContext &, unsigned) noexcept {}
330  void operator delete(void *, const ASTContext *, unsigned) noexcept {}
331  void operator delete(void *, size_t) noexcept {}
332  void operator delete(void *, void *) noexcept {}
333 
334 public:
335  /// A placeholder type used to construct an empty shell of a
336  /// type, that will be filled in later (e.g., by some
337  /// de-serialization).
338  struct EmptyShell {};
339 
340 protected:
341  /// Iterator for iterating over Stmt * arrays that contain only Expr *
342  ///
343  /// This is needed because AST nodes use Stmt* arrays to store
344  /// references to children (to be compatible with StmtIterator).
346  : llvm::iterator_adaptor_base<ExprIterator, Stmt **,
347  std::random_access_iterator_tag, Expr *> {
348  ExprIterator() : iterator_adaptor_base(nullptr) {}
349  ExprIterator(Stmt **I) : iterator_adaptor_base(I) {}
350 
351  reference operator*() const {
352  assert((*I)->getStmtClass() >= firstExprConstant &&
353  (*I)->getStmtClass() <= lastExprConstant);
354  return *reinterpret_cast<Expr **>(I);
355  }
356  };
357 
358  /// Const iterator for iterating over Stmt * arrays that contain only Expr *
360  : llvm::iterator_adaptor_base<ConstExprIterator, const Stmt *const *,
361  std::random_access_iterator_tag,
362  const Expr *const> {
363  ConstExprIterator() : iterator_adaptor_base(nullptr) {}
364  ConstExprIterator(const Stmt *const *I) : iterator_adaptor_base(I) {}
365 
366  reference operator*() const {
367  assert((*I)->getStmtClass() >= firstExprConstant &&
368  (*I)->getStmtClass() <= lastExprConstant);
369  return *reinterpret_cast<const Expr *const *>(I);
370  }
371  };
372 
373 private:
374  /// Whether statistic collection is enabled.
375  static bool StatisticsEnabled;
376 
377 protected:
378  /// Construct an empty statement.
379  explicit Stmt(StmtClass SC, EmptyShell) : Stmt(SC) {}
380 
381 public:
383  static_assert(sizeof(*this) == sizeof(void *),
384  "changing bitfields changed sizeof(Stmt)");
385  static_assert(sizeof(*this) % alignof(void *) == 0,
386  "Insufficient alignment!");
387  StmtBits.sClass = SC;
388  if (StatisticsEnabled) Stmt::addStmtClass(SC);
389  }
390 
392  return static_cast<StmtClass>(StmtBits.sClass);
393  }
394 
395  const char *getStmtClassName() const;
396 
397  /// SourceLocation tokens are not useful in isolation - they are low level
398  /// value objects created/interpreted by SourceManager. We assume AST
399  /// clients will have a pointer to the respective SourceManager.
400  SourceRange getSourceRange() const LLVM_READONLY;
401  SourceLocation getBeginLoc() const LLVM_READONLY;
402  SourceLocation getEndLoc() const LLVM_READONLY;
403 
404  // global temp stats (until we have a per-module visitor)
405  static void addStmtClass(const StmtClass s);
406  static void EnableStatistics();
407  static void PrintStats();
408 
409  /// Dumps the specified AST fragment and all subtrees to
410  /// \c llvm::errs().
411  void dump() const;
412  void dump(SourceManager &SM) const;
413  void dump(raw_ostream &OS, SourceManager &SM) const;
414  void dump(raw_ostream &OS) const;
415 
416  /// \return Unique reproducible object identifier
417  int64_t getID(const ASTContext &Context) const;
418 
419  /// dumpColor - same as dump(), but forces color highlighting.
420  void dumpColor() const;
421 
422  /// dumpPretty/printPretty - These two methods do a "pretty print" of the AST
423  /// back to its original source language syntax.
424  void dumpPretty(const ASTContext &Context) const;
425  void printPretty(raw_ostream &OS, PrinterHelper *Helper,
426  const PrintingPolicy &Policy, unsigned Indentation = 0,
427  StringRef NewlineSymbol = "\n",
428  const ASTContext *Context = nullptr) const;
429 
430  /// viewAST - Visualize an AST rooted at this Stmt* using GraphViz. Only
431  /// works on systems with GraphViz (Mac OS X) or dot+gv installed.
432  void viewAST() const;
433 
434  /// Skip past any implicit AST nodes which might surround this
435  /// statement, such as ExprWithCleanups or ImplicitCastExpr nodes.
436  Stmt *IgnoreImplicit();
437  const Stmt *IgnoreImplicit() const {
438  return const_cast<Stmt *>(this)->IgnoreImplicit();
439  }
440 
441  /// Skip no-op (attributed, compound) container stmts and skip captured
442  /// stmt at the top, if \a IgnoreCaptured is true.
443  Stmt *IgnoreContainers(bool IgnoreCaptured = false);
444  const Stmt *IgnoreContainers(bool IgnoreCaptured = false) const {
445  return const_cast<Stmt *>(this)->IgnoreContainers(IgnoreCaptured);
446  }
447 
448  const Stmt *stripLabelLikeStatements() const;
450  return const_cast<Stmt*>(
451  const_cast<const Stmt*>(this)->stripLabelLikeStatements());
452  }
453 
454  /// Child Iterators: All subclasses must implement 'children'
455  /// to permit easy iteration over the substatements/subexpessions of an
456  /// AST node. This permits easy iteration over all nodes in the AST.
459 
460  using child_range = llvm::iterator_range<child_iterator>;
461  using const_child_range = llvm::iterator_range<const_child_iterator>;
462 
464 
466  auto Children = const_cast<Stmt *>(this)->children();
467  return const_child_range(Children.begin(), Children.end());
468  }
469 
470  child_iterator child_begin() { return children().begin(); }
471  child_iterator child_end() { return children().end(); }
472 
473  const_child_iterator child_begin() const { return children().begin(); }
474  const_child_iterator child_end() const { return children().end(); }
475 
476  /// Produce a unique representation of the given statement.
477  ///
478  /// \param ID once the profiling operation is complete, will contain
479  /// the unique representation of the given statement.
480  ///
481  /// \param Context the AST context in which the statement resides
482  ///
483  /// \param Canonical whether the profile should be based on the canonical
484  /// representation of this statement (e.g., where non-type template
485  /// parameters are identified by index/level rather than their
486  /// declaration pointers) or the exact representation of the statement as
487  /// written in the source.
488  void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
489  bool Canonical) const;
490 
491  /// Calculate a unique representation for a statement that is
492  /// stable across compiler invocations.
493  ///
494  /// \param ID profile information will be stored in ID.
495  ///
496  /// \param Hash an ODRHash object which will be called where pointers would
497  /// have been used in the Profile function.
498  void ProcessODRHash(llvm::FoldingSetNodeID &ID, ODRHash& Hash) const;
499 };
500 
501 /// DeclStmt - Adaptor class for mixing declarations with statements and
502 /// expressions. For example, CompoundStmt mixes statements, expressions
503 /// and declarations (variables, types). Another example is ForStmt, where
504 /// the first statement can be an expression or a declaration.
505 class DeclStmt : public Stmt {
506  DeclGroupRef DG;
507  SourceLocation StartLoc, EndLoc;
508 
509 public:
511  : Stmt(DeclStmtClass), DG(dg), StartLoc(startLoc), EndLoc(endLoc) {}
512 
513  /// Build an empty declaration statement.
514  explicit DeclStmt(EmptyShell Empty) : Stmt(DeclStmtClass, Empty) {}
515 
516  /// isSingleDecl - This method returns true if this DeclStmt refers
517  /// to a single Decl.
518  bool isSingleDecl() const {
519  return DG.isSingleDecl();
520  }
521 
522  const Decl *getSingleDecl() const { return DG.getSingleDecl(); }
523  Decl *getSingleDecl() { return DG.getSingleDecl(); }
524 
525  const DeclGroupRef getDeclGroup() const { return DG; }
526  DeclGroupRef getDeclGroup() { return DG; }
527  void setDeclGroup(DeclGroupRef DGR) { DG = DGR; }
528 
529  void setStartLoc(SourceLocation L) { StartLoc = L; }
530  SourceLocation getEndLoc() const { return EndLoc; }
531  void setEndLoc(SourceLocation L) { EndLoc = L; }
532 
533  SourceLocation getBeginLoc() const LLVM_READONLY { return StartLoc; }
534 
535  static bool classof(const Stmt *T) {
536  return T->getStmtClass() == DeclStmtClass;
537  }
538 
539  // Iterators over subexpressions.
541  return child_range(child_iterator(DG.begin(), DG.end()),
542  child_iterator(DG.end(), DG.end()));
543  }
544 
547  using decl_range = llvm::iterator_range<decl_iterator>;
548  using decl_const_range = llvm::iterator_range<const_decl_iterator>;
549 
550  decl_range decls() { return decl_range(decl_begin(), decl_end()); }
551 
553  return decl_const_range(decl_begin(), decl_end());
554  }
555 
556  decl_iterator decl_begin() { return DG.begin(); }
557  decl_iterator decl_end() { return DG.end(); }
558  const_decl_iterator decl_begin() const { return DG.begin(); }
559  const_decl_iterator decl_end() const { return DG.end(); }
560 
561  using reverse_decl_iterator = std::reverse_iterator<decl_iterator>;
562 
564  return reverse_decl_iterator(decl_end());
565  }
566 
568  return reverse_decl_iterator(decl_begin());
569  }
570 };
571 
572 /// NullStmt - This is the null statement ";": C99 6.8.3p3.
573 ///
574 class NullStmt : public Stmt {
575  SourceLocation SemiLoc;
576 
577  /// True if the null statement was preceded by an empty macro, e.g:
578  /// @code
579  /// #define CALL(x)
580  /// CALL(0);
581  /// @endcode
582  bool HasLeadingEmptyMacro = false;
583 
584 public:
585  friend class ASTStmtReader;
586  friend class ASTStmtWriter;
587 
588  NullStmt(SourceLocation L, bool hasLeadingEmptyMacro = false)
589  : Stmt(NullStmtClass), SemiLoc(L),
590  HasLeadingEmptyMacro(hasLeadingEmptyMacro) {}
591 
592  /// Build an empty null statement.
593  explicit NullStmt(EmptyShell Empty) : Stmt(NullStmtClass, Empty) {}
594 
595  SourceLocation getSemiLoc() const { return SemiLoc; }
596  void setSemiLoc(SourceLocation L) { SemiLoc = L; }
597 
598  bool hasLeadingEmptyMacro() const { return HasLeadingEmptyMacro; }
599 
600  SourceLocation getBeginLoc() const LLVM_READONLY { return SemiLoc; }
601  SourceLocation getEndLoc() const LLVM_READONLY { return SemiLoc; }
602 
603  static bool classof(const Stmt *T) {
604  return T->getStmtClass() == NullStmtClass;
605  }
606 
609  }
610 };
611 
612 /// CompoundStmt - This represents a group of statements like { stmt stmt }.
613 class CompoundStmt final : public Stmt,
614  private llvm::TrailingObjects<CompoundStmt, Stmt *> {
615  friend class ASTStmtReader;
616  friend TrailingObjects;
617 
618  SourceLocation LBraceLoc, RBraceLoc;
619 
621  explicit CompoundStmt(EmptyShell Empty) : Stmt(CompoundStmtClass, Empty) {}
622 
623  void setStmts(ArrayRef<Stmt *> Stmts);
624 
625 public:
626  static CompoundStmt *Create(const ASTContext &C, ArrayRef<Stmt *> Stmts,
628 
629  // Build an empty compound statement with a location.
631  : Stmt(CompoundStmtClass), LBraceLoc(Loc), RBraceLoc(Loc) {
632  CompoundStmtBits.NumStmts = 0;
633  }
634 
635  // Build an empty compound statement.
636  static CompoundStmt *CreateEmpty(const ASTContext &C, unsigned NumStmts);
637 
638  bool body_empty() const { return CompoundStmtBits.NumStmts == 0; }
639  unsigned size() const { return CompoundStmtBits.NumStmts; }
640 
641  using body_iterator = Stmt **;
642  using body_range = llvm::iterator_range<body_iterator>;
643 
644  body_range body() { return body_range(body_begin(), body_end()); }
645  body_iterator body_begin() { return getTrailingObjects<Stmt *>(); }
646  body_iterator body_end() { return body_begin() + size(); }
647  Stmt *body_front() { return !body_empty() ? body_begin()[0] : nullptr; }
648 
650  return !body_empty() ? body_begin()[size() - 1] : nullptr;
651  }
652 
653  void setLastStmt(Stmt *S) {
654  assert(!body_empty() && "setLastStmt");
655  body_begin()[size() - 1] = S;
656  }
657 
658  using const_body_iterator = Stmt* const *;
659  using body_const_range = llvm::iterator_range<const_body_iterator>;
660 
662  return body_const_range(body_begin(), body_end());
663  }
664 
666  return getTrailingObjects<Stmt *>();
667  }
668 
669  const_body_iterator body_end() const { return body_begin() + size(); }
670 
671  const Stmt *body_front() const {
672  return !body_empty() ? body_begin()[0] : nullptr;
673  }
674 
675  const Stmt *body_back() const {
676  return !body_empty() ? body_begin()[size() - 1] : nullptr;
677  }
678 
679  using reverse_body_iterator = std::reverse_iterator<body_iterator>;
680 
682  return reverse_body_iterator(body_end());
683  }
684 
686  return reverse_body_iterator(body_begin());
687  }
688 
690  std::reverse_iterator<const_body_iterator>;
691 
693  return const_reverse_body_iterator(body_end());
694  }
695 
697  return const_reverse_body_iterator(body_begin());
698  }
699 
700  SourceLocation getBeginLoc() const LLVM_READONLY { return LBraceLoc; }
701  SourceLocation getEndLoc() const LLVM_READONLY { return RBraceLoc; }
702 
703  SourceLocation getLBracLoc() const { return LBraceLoc; }
704  SourceLocation getRBracLoc() const { return RBraceLoc; }
705 
706  static bool classof(const Stmt *T) {
707  return T->getStmtClass() == CompoundStmtClass;
708  }
709 
710  // Iterators
711  child_range children() { return child_range(body_begin(), body_end()); }
712 
714  return const_child_range(body_begin(), body_end());
715  }
716 };
717 
718 // SwitchCase is the base class for CaseStmt and DefaultStmt,
719 class SwitchCase : public Stmt {
720 protected:
721  // A pointer to the following CaseStmt or DefaultStmt class,
722  // used by SwitchStmt.
723  SwitchCase *NextSwitchCase = nullptr;
726 
728  : Stmt(SC), KeywordLoc(KWLoc), ColonLoc(ColonLoc) {}
729 
731 
732 public:
733  const SwitchCase *getNextSwitchCase() const { return NextSwitchCase; }
734 
735  SwitchCase *getNextSwitchCase() { return NextSwitchCase; }
736 
737  void setNextSwitchCase(SwitchCase *SC) { NextSwitchCase = SC; }
738 
739  SourceLocation getKeywordLoc() const { return KeywordLoc; }
740  void setKeywordLoc(SourceLocation L) { KeywordLoc = L; }
741  SourceLocation getColonLoc() const { return ColonLoc; }
742  void setColonLoc(SourceLocation L) { ColonLoc = L; }
743 
744  Stmt *getSubStmt();
745  const Stmt *getSubStmt() const {
746  return const_cast<SwitchCase*>(this)->getSubStmt();
747  }
748 
749  SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
750  SourceLocation getEndLoc() const LLVM_READONLY;
751 
752  static bool classof(const Stmt *T) {
753  return T->getStmtClass() == CaseStmtClass ||
754  T->getStmtClass() == DefaultStmtClass;
755  }
756 };
757 
758 class CaseStmt : public SwitchCase {
759  SourceLocation EllipsisLoc;
760  enum { LHS, RHS, SUBSTMT, END_EXPR };
761  Stmt* SubExprs[END_EXPR]; // The expression for the RHS is Non-null for
762  // GNU "case 1 ... 4" extension
763 
764 public:
765  CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc,
766  SourceLocation ellipsisLoc, SourceLocation colonLoc)
767  : SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
768  SubExprs[SUBSTMT] = nullptr;
769  SubExprs[LHS] = reinterpret_cast<Stmt*>(lhs);
770  SubExprs[RHS] = reinterpret_cast<Stmt*>(rhs);
771  EllipsisLoc = ellipsisLoc;
772  }
773 
774  /// Build an empty switch case statement.
775  explicit CaseStmt(EmptyShell Empty) : SwitchCase(CaseStmtClass, Empty) {}
776 
777  SourceLocation getCaseLoc() const { return KeywordLoc; }
778  void setCaseLoc(SourceLocation L) { KeywordLoc = L; }
779  SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
780  void setEllipsisLoc(SourceLocation L) { EllipsisLoc = L; }
781  SourceLocation getColonLoc() const { return ColonLoc; }
783 
784  Expr *getLHS() { return reinterpret_cast<Expr*>(SubExprs[LHS]); }
785  Expr *getRHS() { return reinterpret_cast<Expr*>(SubExprs[RHS]); }
786  Stmt *getSubStmt() { return SubExprs[SUBSTMT]; }
787 
788  const Expr *getLHS() const {
789  return reinterpret_cast<const Expr*>(SubExprs[LHS]);
790  }
791 
792  const Expr *getRHS() const {
793  return reinterpret_cast<const Expr*>(SubExprs[RHS]);
794  }
795 
796  const Stmt *getSubStmt() const { return SubExprs[SUBSTMT]; }
797 
798  void setSubStmt(Stmt *S) { SubExprs[SUBSTMT] = S; }
799  void setLHS(Expr *Val) { SubExprs[LHS] = reinterpret_cast<Stmt*>(Val); }
800  void setRHS(Expr *Val) { SubExprs[RHS] = reinterpret_cast<Stmt*>(Val); }
801 
802  SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
803 
804  SourceLocation getEndLoc() const LLVM_READONLY {
805  // Handle deeply nested case statements with iteration instead of recursion.
806  const CaseStmt *CS = this;
807  while (const auto *CS2 = dyn_cast<CaseStmt>(CS->getSubStmt()))
808  CS = CS2;
809 
810  return CS->getSubStmt()->getEndLoc();
811  }
812 
813  static bool classof(const Stmt *T) {
814  return T->getStmtClass() == CaseStmtClass;
815  }
816 
817  // Iterators
819  return child_range(&SubExprs[0], &SubExprs[END_EXPR]);
820  }
821 };
822 
823 class DefaultStmt : public SwitchCase {
824  Stmt* SubStmt;
825 
826 public:
828  SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {}
829 
830  /// Build an empty default statement.
831  explicit DefaultStmt(EmptyShell Empty)
832  : SwitchCase(DefaultStmtClass, Empty) {}
833 
834  Stmt *getSubStmt() { return SubStmt; }
835  const Stmt *getSubStmt() const { return SubStmt; }
836  void setSubStmt(Stmt *S) { SubStmt = S; }
837 
838  SourceLocation getDefaultLoc() const { return KeywordLoc; }
839  void setDefaultLoc(SourceLocation L) { KeywordLoc = L; }
840  SourceLocation getColonLoc() const { return ColonLoc; }
842 
843  SourceLocation getBeginLoc() const LLVM_READONLY { return KeywordLoc; }
844  SourceLocation getEndLoc() const LLVM_READONLY {
845  return SubStmt->getEndLoc();
846  }
847 
848  static bool classof(const Stmt *T) {
849  return T->getStmtClass() == DefaultStmtClass;
850  }
851 
852  // Iterators
853  child_range children() { return child_range(&SubStmt, &SubStmt+1); }
854 };
855 
856 inline SourceLocation SwitchCase::getEndLoc() const {
857  if (const auto *CS = dyn_cast<CaseStmt>(this))
858  return CS->getEndLoc();
859  return cast<DefaultStmt>(this)->getEndLoc();
860 }
861 
862 /// LabelStmt - Represents a label, which has a substatement. For example:
863 /// foo: return;
864 class LabelStmt : public Stmt {
865  SourceLocation IdentLoc;
866  LabelDecl *TheDecl;
867  Stmt *SubStmt;
868 
869 public:
871  : Stmt(LabelStmtClass), IdentLoc(IL), TheDecl(D), SubStmt(substmt) {
872  static_assert(sizeof(LabelStmt) ==
873  2 * sizeof(SourceLocation) + 2 * sizeof(void *),
874  "LabelStmt too big");
875  }
876 
877  // Build an empty label statement.
878  explicit LabelStmt(EmptyShell Empty) : Stmt(LabelStmtClass, Empty) {}
879 
880  SourceLocation getIdentLoc() const { return IdentLoc; }
881  LabelDecl *getDecl() const { return TheDecl; }
882  void setDecl(LabelDecl *D) { TheDecl = D; }
883  const char *getName() const;
884  Stmt *getSubStmt() { return SubStmt; }
885  const Stmt *getSubStmt() const { return SubStmt; }
886  void setIdentLoc(SourceLocation L) { IdentLoc = L; }
887  void setSubStmt(Stmt *SS) { SubStmt = SS; }
888 
889  SourceLocation getBeginLoc() const LLVM_READONLY { return IdentLoc; }
890  SourceLocation getEndLoc() const LLVM_READONLY {
891  return SubStmt->getEndLoc();
892  }
893 
894  child_range children() { return child_range(&SubStmt, &SubStmt+1); }
895 
896  static bool classof(const Stmt *T) {
897  return T->getStmtClass() == LabelStmtClass;
898  }
899 };
900 
901 /// Represents an attribute applied to a statement.
902 ///
903 /// Represents an attribute applied to a statement. For example:
904 /// [[omp::for(...)]] for (...) { ... }
905 class AttributedStmt final
906  : public Stmt,
907  private llvm::TrailingObjects<AttributedStmt, const Attr *> {
908  friend class ASTStmtReader;
909  friend TrailingObjects;
910 
911  Stmt *SubStmt;
912  SourceLocation AttrLoc;
913  unsigned NumAttrs;
914 
916  : Stmt(AttributedStmtClass), SubStmt(SubStmt), AttrLoc(Loc),
917  NumAttrs(Attrs.size()) {
918  std::copy(Attrs.begin(), Attrs.end(), getAttrArrayPtr());
919  }
920 
921  explicit AttributedStmt(EmptyShell Empty, unsigned NumAttrs)
922  : Stmt(AttributedStmtClass, Empty), NumAttrs(NumAttrs) {
923  std::fill_n(getAttrArrayPtr(), NumAttrs, nullptr);
924  }
925 
926  const Attr *const *getAttrArrayPtr() const {
927  return getTrailingObjects<const Attr *>();
928  }
929  const Attr **getAttrArrayPtr() { return getTrailingObjects<const Attr *>(); }
930 
931 public:
932  static AttributedStmt *Create(const ASTContext &C, SourceLocation Loc,
933  ArrayRef<const Attr*> Attrs, Stmt *SubStmt);
934 
935  // Build an empty attributed statement.
936  static AttributedStmt *CreateEmpty(const ASTContext &C, unsigned NumAttrs);
937 
938  SourceLocation getAttrLoc() const { return AttrLoc; }
940  return llvm::makeArrayRef(getAttrArrayPtr(), NumAttrs);
941  }
942 
943  Stmt *getSubStmt() { return SubStmt; }
944  const Stmt *getSubStmt() const { return SubStmt; }
945 
946  SourceLocation getBeginLoc() const LLVM_READONLY { return AttrLoc; }
947  SourceLocation getEndLoc() const LLVM_READONLY {
948  return SubStmt->getEndLoc();
949  }
950 
951  child_range children() { return child_range(&SubStmt, &SubStmt + 1); }
952 
953  static bool classof(const Stmt *T) {
954  return T->getStmtClass() == AttributedStmtClass;
955  }
956 };
957 
958 /// IfStmt - This represents an if/then/else.
959 class IfStmt : public Stmt {
960  enum { INIT, VAR, COND, THEN, ELSE, END_EXPR };
961  Stmt* SubExprs[END_EXPR];
962 
963  SourceLocation IfLoc;
964  SourceLocation ElseLoc;
965 
966 public:
967  IfStmt(const ASTContext &C, SourceLocation IL,
968  bool IsConstexpr, Stmt *init, VarDecl *var, Expr *cond,
969  Stmt *then, SourceLocation EL = SourceLocation(),
970  Stmt *elsev = nullptr);
971 
972  /// Build an empty if/then/else statement
973  explicit IfStmt(EmptyShell Empty) : Stmt(IfStmtClass, Empty) {}
974 
975  /// Retrieve the variable declared in this "if" statement, if any.
976  ///
977  /// In the following example, "x" is the condition variable.
978  /// \code
979  /// if (int x = foo()) {
980  /// printf("x is %d", x);
981  /// }
982  /// \endcode
983  VarDecl *getConditionVariable() const;
984  void setConditionVariable(const ASTContext &C, VarDecl *V);
985 
986  /// If this IfStmt has a condition variable, return the faux DeclStmt
987  /// associated with the creation of that condition variable.
989  return reinterpret_cast<DeclStmt*>(SubExprs[VAR]);
990  }
991 
992  Stmt *getInit() { return SubExprs[INIT]; }
993  const Stmt *getInit() const { return SubExprs[INIT]; }
994  void setInit(Stmt *S) { SubExprs[INIT] = S; }
995  const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
996  void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt *>(E); }
997  const Stmt *getThen() const { return SubExprs[THEN]; }
998  void setThen(Stmt *S) { SubExprs[THEN] = S; }
999  const Stmt *getElse() const { return SubExprs[ELSE]; }
1000  void setElse(Stmt *S) { SubExprs[ELSE] = S; }
1001 
1002  Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
1003  Stmt *getThen() { return SubExprs[THEN]; }
1004  Stmt *getElse() { return SubExprs[ELSE]; }
1005 
1006  SourceLocation getIfLoc() const { return IfLoc; }
1007  void setIfLoc(SourceLocation L) { IfLoc = L; }
1008  SourceLocation getElseLoc() const { return ElseLoc; }
1009  void setElseLoc(SourceLocation L) { ElseLoc = L; }
1010 
1011  bool isConstexpr() const { return IfStmtBits.IsConstexpr; }
1012  void setConstexpr(bool C) { IfStmtBits.IsConstexpr = C; }
1013 
1014  bool isObjCAvailabilityCheck() const;
1015 
1016  SourceLocation getBeginLoc() const LLVM_READONLY { return IfLoc; }
1017 
1018  SourceLocation getEndLoc() const LLVM_READONLY {
1019  if (SubExprs[ELSE])
1020  return SubExprs[ELSE]->getEndLoc();
1021  else
1022  return SubExprs[THEN]->getEndLoc();
1023  }
1024 
1025  // Iterators over subexpressions. The iterators will include iterating
1026  // over the initialization expression referenced by the condition variable.
1028  return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1029  }
1030 
1031  static bool classof(const Stmt *T) {
1032  return T->getStmtClass() == IfStmtClass;
1033  }
1034 };
1035 
1036 /// SwitchStmt - This represents a 'switch' stmt.
1037 class SwitchStmt : public Stmt {
1038  SourceLocation SwitchLoc;
1039  enum { INIT, VAR, COND, BODY, END_EXPR };
1040  Stmt* SubExprs[END_EXPR];
1041 
1042  // This points to a linked list of case and default statements and, if the
1043  // SwitchStmt is a switch on an enum value, records whether all the enum
1044  // values were covered by CaseStmts. The coverage information value is meant
1045  // to be a hint for possible clients.
1046  llvm::PointerIntPair<SwitchCase *, 1, bool> FirstCase;
1047 
1048 public:
1049  SwitchStmt(const ASTContext &C, Stmt *Init, VarDecl *Var, Expr *cond);
1050 
1051  /// Build a empty switch statement.
1052  explicit SwitchStmt(EmptyShell Empty) : Stmt(SwitchStmtClass, Empty) {}
1053 
1054  /// Retrieve the variable declared in this "switch" statement, if any.
1055  ///
1056  /// In the following example, "x" is the condition variable.
1057  /// \code
1058  /// switch (int x = foo()) {
1059  /// case 0: break;
1060  /// // ...
1061  /// }
1062  /// \endcode
1063  VarDecl *getConditionVariable() const;
1064  void setConditionVariable(const ASTContext &C, VarDecl *V);
1065 
1066  /// If this SwitchStmt has a condition variable, return the faux DeclStmt
1067  /// associated with the creation of that condition variable.
1069  return reinterpret_cast<DeclStmt*>(SubExprs[VAR]);
1070  }
1071 
1072  Stmt *getInit() { return SubExprs[INIT]; }
1073  const Stmt *getInit() const { return SubExprs[INIT]; }
1074  void setInit(Stmt *S) { SubExprs[INIT] = S; }
1075  const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
1076  const Stmt *getBody() const { return SubExprs[BODY]; }
1077  const SwitchCase *getSwitchCaseList() const { return FirstCase.getPointer(); }
1078 
1079  Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]);}
1080  void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt *>(E); }
1081  Stmt *getBody() { return SubExprs[BODY]; }
1082  void setBody(Stmt *S) { SubExprs[BODY] = S; }
1083  SwitchCase *getSwitchCaseList() { return FirstCase.getPointer(); }
1084 
1085  /// Set the case list for this switch statement.
1086  void setSwitchCaseList(SwitchCase *SC) { FirstCase.setPointer(SC); }
1087 
1088  SourceLocation getSwitchLoc() const { return SwitchLoc; }
1089  void setSwitchLoc(SourceLocation L) { SwitchLoc = L; }
1090 
1091  void setBody(Stmt *S, SourceLocation SL) {
1092  SubExprs[BODY] = S;
1093  SwitchLoc = SL;
1094  }
1095 
1097  assert(!SC->getNextSwitchCase()
1098  && "case/default already added to a switch");
1099  SC->setNextSwitchCase(FirstCase.getPointer());
1100  FirstCase.setPointer(SC);
1101  }
1102 
1103  /// Set a flag in the SwitchStmt indicating that if the 'switch (X)' is a
1104  /// switch over an enum value then all cases have been explicitly covered.
1105  void setAllEnumCasesCovered() { FirstCase.setInt(true); }
1106 
1107  /// Returns true if the SwitchStmt is a switch of an enum value and all cases
1108  /// have been explicitly covered.
1109  bool isAllEnumCasesCovered() const { return FirstCase.getInt(); }
1110 
1111  SourceLocation getBeginLoc() const LLVM_READONLY { return SwitchLoc; }
1112 
1113  SourceLocation getEndLoc() const LLVM_READONLY {
1114  return SubExprs[BODY] ? SubExprs[BODY]->getEndLoc()
1115  : SubExprs[COND]->getEndLoc();
1116  }
1117 
1118  // Iterators
1120  return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1121  }
1122 
1123  static bool classof(const Stmt *T) {
1124  return T->getStmtClass() == SwitchStmtClass;
1125  }
1126 };
1127 
1128 /// WhileStmt - This represents a 'while' stmt.
1129 class WhileStmt : public Stmt {
1130  SourceLocation WhileLoc;
1131  enum { VAR, COND, BODY, END_EXPR };
1132  Stmt* SubExprs[END_EXPR];
1133 
1134 public:
1135  WhileStmt(const ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body,
1136  SourceLocation WL);
1137 
1138  /// Build an empty while statement.
1139  explicit WhileStmt(EmptyShell Empty) : Stmt(WhileStmtClass, Empty) {}
1140 
1141  /// Retrieve the variable declared in this "while" statement, if any.
1142  ///
1143  /// In the following example, "x" is the condition variable.
1144  /// \code
1145  /// while (int x = random()) {
1146  /// // ...
1147  /// }
1148  /// \endcode
1149  VarDecl *getConditionVariable() const;
1150  void setConditionVariable(const ASTContext &C, VarDecl *V);
1151 
1152  /// If this WhileStmt has a condition variable, return the faux DeclStmt
1153  /// associated with the creation of that condition variable.
1155  return reinterpret_cast<DeclStmt*>(SubExprs[VAR]);
1156  }
1157 
1158  Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
1159  const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
1160  void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt*>(E); }
1161  Stmt *getBody() { return SubExprs[BODY]; }
1162  const Stmt *getBody() const { return SubExprs[BODY]; }
1163  void setBody(Stmt *S) { SubExprs[BODY] = S; }
1164 
1165  SourceLocation getWhileLoc() const { return WhileLoc; }
1166  void setWhileLoc(SourceLocation L) { WhileLoc = L; }
1167 
1168  SourceLocation getBeginLoc() const LLVM_READONLY { return WhileLoc; }
1169 
1170  SourceLocation getEndLoc() const LLVM_READONLY {
1171  return SubExprs[BODY]->getEndLoc();
1172  }
1173 
1174  static bool classof(const Stmt *T) {
1175  return T->getStmtClass() == WhileStmtClass;
1176  }
1177 
1178  // Iterators
1180  return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1181  }
1182 };
1183 
1184 /// DoStmt - This represents a 'do/while' stmt.
1185 class DoStmt : public Stmt {
1186  SourceLocation DoLoc;
1187  enum { BODY, COND, END_EXPR };
1188  Stmt* SubExprs[END_EXPR];
1189  SourceLocation WhileLoc;
1190  SourceLocation RParenLoc; // Location of final ')' in do stmt condition.
1191 
1192 public:
1194  SourceLocation RP)
1195  : Stmt(DoStmtClass), DoLoc(DL), WhileLoc(WL), RParenLoc(RP) {
1196  SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
1197  SubExprs[BODY] = body;
1198  }
1199 
1200  /// Build an empty do-while statement.
1201  explicit DoStmt(EmptyShell Empty) : Stmt(DoStmtClass, Empty) {}
1202 
1203  Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
1204  const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
1205  void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt*>(E); }
1206  Stmt *getBody() { return SubExprs[BODY]; }
1207  const Stmt *getBody() const { return SubExprs[BODY]; }
1208  void setBody(Stmt *S) { SubExprs[BODY] = S; }
1209 
1210  SourceLocation getDoLoc() const { return DoLoc; }
1211  void setDoLoc(SourceLocation L) { DoLoc = L; }
1212  SourceLocation getWhileLoc() const { return WhileLoc; }
1213  void setWhileLoc(SourceLocation L) { WhileLoc = L; }
1214 
1215  SourceLocation getRParenLoc() const { return RParenLoc; }
1216  void setRParenLoc(SourceLocation L) { RParenLoc = L; }
1217 
1218  SourceLocation getBeginLoc() const LLVM_READONLY { return DoLoc; }
1219  SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
1220 
1221  static bool classof(const Stmt *T) {
1222  return T->getStmtClass() == DoStmtClass;
1223  }
1224 
1225  // Iterators
1227  return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1228  }
1229 };
1230 
1231 /// ForStmt - This represents a 'for (init;cond;inc)' stmt. Note that any of
1232 /// the init/cond/inc parts of the ForStmt will be null if they were not
1233 /// specified in the source.
1234 class ForStmt : public Stmt {
1235  SourceLocation ForLoc;
1236  enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
1237  Stmt* SubExprs[END_EXPR]; // SubExprs[INIT] is an expression or declstmt.
1238  SourceLocation LParenLoc, RParenLoc;
1239 
1240 public:
1241  ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar,
1242  Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP,
1243  SourceLocation RP);
1244 
1245  /// Build an empty for statement.
1246  explicit ForStmt(EmptyShell Empty) : Stmt(ForStmtClass, Empty) {}
1247 
1248  Stmt *getInit() { return SubExprs[INIT]; }
1249 
1250  /// Retrieve the variable declared in this "for" statement, if any.
1251  ///
1252  /// In the following example, "y" is the condition variable.
1253  /// \code
1254  /// for (int x = random(); int y = mangle(x); ++x) {
1255  /// // ...
1256  /// }
1257  /// \endcode
1258  VarDecl *getConditionVariable() const;
1259  void setConditionVariable(const ASTContext &C, VarDecl *V);
1260 
1261  /// If this ForStmt has a condition variable, return the faux DeclStmt
1262  /// associated with the creation of that condition variable.
1264  return reinterpret_cast<DeclStmt*>(SubExprs[CONDVAR]);
1265  }
1266 
1267  Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
1268  Expr *getInc() { return reinterpret_cast<Expr*>(SubExprs[INC]); }
1269  Stmt *getBody() { return SubExprs[BODY]; }
1270 
1271  const Stmt *getInit() const { return SubExprs[INIT]; }
1272  const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
1273  const Expr *getInc() const { return reinterpret_cast<Expr*>(SubExprs[INC]); }
1274  const Stmt *getBody() const { return SubExprs[BODY]; }
1275 
1276  void setInit(Stmt *S) { SubExprs[INIT] = S; }
1277  void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt*>(E); }
1278  void setInc(Expr *E) { SubExprs[INC] = reinterpret_cast<Stmt*>(E); }
1279  void setBody(Stmt *S) { SubExprs[BODY] = S; }
1280 
1281  SourceLocation getForLoc() const { return ForLoc; }
1282  void setForLoc(SourceLocation L) { ForLoc = L; }
1283  SourceLocation getLParenLoc() const { return LParenLoc; }
1284  void setLParenLoc(SourceLocation L) { LParenLoc = L; }
1285  SourceLocation getRParenLoc() const { return RParenLoc; }
1286  void setRParenLoc(SourceLocation L) { RParenLoc = L; }
1287 
1288  SourceLocation getBeginLoc() const LLVM_READONLY { return ForLoc; }
1289 
1290  SourceLocation getEndLoc() const LLVM_READONLY {
1291  return SubExprs[BODY]->getEndLoc();
1292  }
1293 
1294  static bool classof(const Stmt *T) {
1295  return T->getStmtClass() == ForStmtClass;
1296  }
1297 
1298  // Iterators
1300  return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1301  }
1302 };
1303 
1304 /// GotoStmt - This represents a direct goto.
1305 class GotoStmt : public Stmt {
1306  LabelDecl *Label;
1307  SourceLocation GotoLoc;
1308  SourceLocation LabelLoc;
1309 
1310 public:
1312  : Stmt(GotoStmtClass), Label(label), GotoLoc(GL), LabelLoc(LL) {}
1313 
1314  /// Build an empty goto statement.
1315  explicit GotoStmt(EmptyShell Empty) : Stmt(GotoStmtClass, Empty) {}
1316 
1317  LabelDecl *getLabel() const { return Label; }
1318  void setLabel(LabelDecl *D) { Label = D; }
1319 
1320  SourceLocation getGotoLoc() const { return GotoLoc; }
1321  void setGotoLoc(SourceLocation L) { GotoLoc = L; }
1322  SourceLocation getLabelLoc() const { return LabelLoc; }
1323  void setLabelLoc(SourceLocation L) { LabelLoc = L; }
1324 
1325  SourceLocation getBeginLoc() const LLVM_READONLY { return GotoLoc; }
1326  SourceLocation getEndLoc() const LLVM_READONLY { return LabelLoc; }
1327 
1328  static bool classof(const Stmt *T) {
1329  return T->getStmtClass() == GotoStmtClass;
1330  }
1331 
1332  // Iterators
1335  }
1336 };
1337 
1338 /// IndirectGotoStmt - This represents an indirect goto.
1339 class IndirectGotoStmt : public Stmt {
1340  SourceLocation GotoLoc;
1341  SourceLocation StarLoc;
1342  Stmt *Target;
1343 
1344 public:
1346  Expr *target)
1347  : Stmt(IndirectGotoStmtClass), GotoLoc(gotoLoc), StarLoc(starLoc),
1348  Target((Stmt*)target) {}
1349 
1350  /// Build an empty indirect goto statement.
1352  : Stmt(IndirectGotoStmtClass, Empty) {}
1353 
1354  void setGotoLoc(SourceLocation L) { GotoLoc = L; }
1355  SourceLocation getGotoLoc() const { return GotoLoc; }
1356  void setStarLoc(SourceLocation L) { StarLoc = L; }
1357  SourceLocation getStarLoc() const { return StarLoc; }
1358 
1359  Expr *getTarget() { return reinterpret_cast<Expr*>(Target); }
1360  const Expr *getTarget() const {return reinterpret_cast<const Expr*>(Target);}
1361  void setTarget(Expr *E) { Target = reinterpret_cast<Stmt*>(E); }
1362 
1363  /// getConstantTarget - Returns the fixed target of this indirect
1364  /// goto, if one exists.
1365  LabelDecl *getConstantTarget();
1366  const LabelDecl *getConstantTarget() const {
1367  return const_cast<IndirectGotoStmt*>(this)->getConstantTarget();
1368  }
1369 
1370  SourceLocation getBeginLoc() const LLVM_READONLY { return GotoLoc; }
1371  SourceLocation getEndLoc() const LLVM_READONLY { return Target->getEndLoc(); }
1372 
1373  static bool classof(const Stmt *T) {
1374  return T->getStmtClass() == IndirectGotoStmtClass;
1375  }
1376 
1377  // Iterators
1378  child_range children() { return child_range(&Target, &Target+1); }
1379 };
1380 
1381 /// ContinueStmt - This represents a continue.
1382 class ContinueStmt : public Stmt {
1383  SourceLocation ContinueLoc;
1384 
1385 public:
1386  ContinueStmt(SourceLocation CL) : Stmt(ContinueStmtClass), ContinueLoc(CL) {}
1387 
1388  /// Build an empty continue statement.
1389  explicit ContinueStmt(EmptyShell Empty) : Stmt(ContinueStmtClass, Empty) {}
1390 
1391  SourceLocation getContinueLoc() const { return ContinueLoc; }
1392  void setContinueLoc(SourceLocation L) { ContinueLoc = L; }
1393 
1394  SourceLocation getBeginLoc() const LLVM_READONLY { return ContinueLoc; }
1395  SourceLocation getEndLoc() const LLVM_READONLY { return ContinueLoc; }
1396 
1397  static bool classof(const Stmt *T) {
1398  return T->getStmtClass() == ContinueStmtClass;
1399  }
1400 
1401  // Iterators
1404  }
1405 };
1406 
1407 /// BreakStmt - This represents a break.
1408 class BreakStmt : public Stmt {
1409  SourceLocation BreakLoc;
1410 
1411 public:
1412  BreakStmt(SourceLocation BL) : Stmt(BreakStmtClass), BreakLoc(BL) {
1413  static_assert(sizeof(BreakStmt) == 2 * sizeof(SourceLocation),
1414  "BreakStmt too large");
1415  }
1416 
1417  /// Build an empty break statement.
1418  explicit BreakStmt(EmptyShell Empty) : Stmt(BreakStmtClass, Empty) {}
1419 
1420  SourceLocation getBreakLoc() const { return BreakLoc; }
1421  void setBreakLoc(SourceLocation L) { BreakLoc = L; }
1422 
1423  SourceLocation getBeginLoc() const LLVM_READONLY { return BreakLoc; }
1424  SourceLocation getEndLoc() const LLVM_READONLY { return BreakLoc; }
1425 
1426  static bool classof(const Stmt *T) {
1427  return T->getStmtClass() == BreakStmtClass;
1428  }
1429 
1430  // Iterators
1433  }
1434 };
1435 
1436 /// ReturnStmt - This represents a return, optionally of an expression:
1437 /// return;
1438 /// return 4;
1439 ///
1440 /// Note that GCC allows return with no argument in a function declared to
1441 /// return a value, and it allows returning a value in functions declared to
1442 /// return void. We explicitly model this in the AST, which means you can't
1443 /// depend on the return type of the function and the presence of an argument.
1444 class ReturnStmt : public Stmt {
1445  SourceLocation RetLoc;
1446  Stmt *RetExpr;
1447  const VarDecl *NRVOCandidate;
1448 
1449 public:
1450  explicit ReturnStmt(SourceLocation RL) : ReturnStmt(RL, nullptr, nullptr) {}
1451 
1452  ReturnStmt(SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
1453  : Stmt(ReturnStmtClass), RetLoc(RL), RetExpr((Stmt *)E),
1454  NRVOCandidate(NRVOCandidate) {}
1455 
1456  /// Build an empty return expression.
1457  explicit ReturnStmt(EmptyShell Empty) : Stmt(ReturnStmtClass, Empty) {}
1458 
1459  const Expr *getRetValue() const;
1460  Expr *getRetValue();
1461  void setRetValue(Expr *E) { RetExpr = reinterpret_cast<Stmt*>(E); }
1462 
1463  SourceLocation getReturnLoc() const { return RetLoc; }
1464  void setReturnLoc(SourceLocation L) { RetLoc = L; }
1465 
1466  /// Retrieve the variable that might be used for the named return
1467  /// value optimization.
1468  ///
1469  /// The optimization itself can only be performed if the variable is
1470  /// also marked as an NRVO object.
1471  const VarDecl *getNRVOCandidate() const { return NRVOCandidate; }
1472  void setNRVOCandidate(const VarDecl *Var) { NRVOCandidate = Var; }
1473 
1474  SourceLocation getBeginLoc() const LLVM_READONLY { return RetLoc; }
1475 
1476  SourceLocation getEndLoc() const LLVM_READONLY {
1477  return RetExpr ? RetExpr->getEndLoc() : RetLoc;
1478  }
1479 
1480  static bool classof(const Stmt *T) {
1481  return T->getStmtClass() == ReturnStmtClass;
1482  }
1483 
1484  // Iterators
1486  if (RetExpr) return child_range(&RetExpr, &RetExpr+1);
1488  }
1489 };
1490 
1491 /// AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
1492 class AsmStmt : public Stmt {
1493 protected:
1494  friend class ASTStmtReader;
1495 
1497 
1498  /// True if the assembly statement does not have any input or output
1499  /// operands.
1500  bool IsSimple;
1501 
1502  /// If true, treat this inline assembly as having side effects.
1503  /// This assembly statement should not be optimized, deleted or moved.
1505 
1506  unsigned NumOutputs;
1507  unsigned NumInputs;
1508  unsigned NumClobbers;
1509 
1510  Stmt **Exprs = nullptr;
1511 
1512  AsmStmt(StmtClass SC, SourceLocation asmloc, bool issimple, bool isvolatile,
1513  unsigned numoutputs, unsigned numinputs, unsigned numclobbers)
1514  : Stmt (SC), AsmLoc(asmloc), IsSimple(issimple), IsVolatile(isvolatile),
1515  NumOutputs(numoutputs), NumInputs(numinputs),
1516  NumClobbers(numclobbers) {}
1517 
1518 public:
1519  /// Build an empty inline-assembly statement.
1520  explicit AsmStmt(StmtClass SC, EmptyShell Empty) : Stmt(SC, Empty) {}
1521 
1522  SourceLocation getAsmLoc() const { return AsmLoc; }
1523  void setAsmLoc(SourceLocation L) { AsmLoc = L; }
1524 
1525  bool isSimple() const { return IsSimple; }
1526  void setSimple(bool V) { IsSimple = V; }
1527 
1528  bool isVolatile() const { return IsVolatile; }
1529  void setVolatile(bool V) { IsVolatile = V; }
1530 
1531  SourceLocation getBeginLoc() const LLVM_READONLY { return {}; }
1532  SourceLocation getEndLoc() const LLVM_READONLY { return {}; }
1533 
1534  //===--- Asm String Analysis ---===//
1535 
1536  /// Assemble final IR asm string.
1537  std::string generateAsmString(const ASTContext &C) const;
1538 
1539  //===--- Output operands ---===//
1540 
1541  unsigned getNumOutputs() const { return NumOutputs; }
1542 
1543  /// getOutputConstraint - Return the constraint string for the specified
1544  /// output operand. All output constraints are known to be non-empty (either
1545  /// '=' or '+').
1546  StringRef getOutputConstraint(unsigned i) const;
1547 
1548  /// isOutputPlusConstraint - Return true if the specified output constraint
1549  /// is a "+" constraint (which is both an input and an output) or false if it
1550  /// is an "=" constraint (just an output).
1551  bool isOutputPlusConstraint(unsigned i) const {
1552  return getOutputConstraint(i)[0] == '+';
1553  }
1554 
1555  const Expr *getOutputExpr(unsigned i) const;
1556 
1557  /// getNumPlusOperands - Return the number of output operands that have a "+"
1558  /// constraint.
1559  unsigned getNumPlusOperands() const;
1560 
1561  //===--- Input operands ---===//
1562 
1563  unsigned getNumInputs() const { return NumInputs; }
1564 
1565  /// getInputConstraint - Return the specified input constraint. Unlike output
1566  /// constraints, these can be empty.
1567  StringRef getInputConstraint(unsigned i) const;
1568 
1569  const Expr *getInputExpr(unsigned i) const;
1570 
1571  //===--- Other ---===//
1572 
1573  unsigned getNumClobbers() const { return NumClobbers; }
1574  StringRef getClobber(unsigned i) const;
1575 
1576  static bool classof(const Stmt *T) {
1577  return T->getStmtClass() == GCCAsmStmtClass ||
1578  T->getStmtClass() == MSAsmStmtClass;
1579  }
1580 
1581  // Input expr iterators.
1582 
1585  using inputs_range = llvm::iterator_range<inputs_iterator>;
1586  using inputs_const_range = llvm::iterator_range<const_inputs_iterator>;
1587 
1589  return &Exprs[0] + NumOutputs;
1590  }
1591 
1593  return &Exprs[0] + NumOutputs + NumInputs;
1594  }
1595 
1596  inputs_range inputs() { return inputs_range(begin_inputs(), end_inputs()); }
1597 
1599  return &Exprs[0] + NumOutputs;
1600  }
1601 
1603  return &Exprs[0] + NumOutputs + NumInputs;
1604  }
1605 
1607  return inputs_const_range(begin_inputs(), end_inputs());
1608  }
1609 
1610  // Output expr iterators.
1611 
1614  using outputs_range = llvm::iterator_range<outputs_iterator>;
1615  using outputs_const_range = llvm::iterator_range<const_outputs_iterator>;
1616 
1618  return &Exprs[0];
1619  }
1620 
1622  return &Exprs[0] + NumOutputs;
1623  }
1624 
1626  return outputs_range(begin_outputs(), end_outputs());
1627  }
1628 
1630  return &Exprs[0];
1631  }
1632 
1634  return &Exprs[0] + NumOutputs;
1635  }
1636 
1638  return outputs_const_range(begin_outputs(), end_outputs());
1639  }
1640 
1642  return child_range(&Exprs[0], &Exprs[0] + NumOutputs + NumInputs);
1643  }
1644 };
1645 
1646 /// This represents a GCC inline-assembly statement extension.
1647 class GCCAsmStmt : public AsmStmt {
1648  friend class ASTStmtReader;
1649 
1650  SourceLocation RParenLoc;
1651  StringLiteral *AsmStr;
1652 
1653  // FIXME: If we wanted to, we could allocate all of these in one big array.
1654  StringLiteral **Constraints = nullptr;
1655  StringLiteral **Clobbers = nullptr;
1656  IdentifierInfo **Names = nullptr;
1657 
1658 public:
1659  GCCAsmStmt(const ASTContext &C, SourceLocation asmloc, bool issimple,
1660  bool isvolatile, unsigned numoutputs, unsigned numinputs,
1661  IdentifierInfo **names, StringLiteral **constraints, Expr **exprs,
1662  StringLiteral *asmstr, unsigned numclobbers,
1663  StringLiteral **clobbers, SourceLocation rparenloc);
1664 
1665  /// Build an empty inline-assembly statement.
1666  explicit GCCAsmStmt(EmptyShell Empty) : AsmStmt(GCCAsmStmtClass, Empty) {}
1667 
1668  SourceLocation getRParenLoc() const { return RParenLoc; }
1669  void setRParenLoc(SourceLocation L) { RParenLoc = L; }
1670 
1671  //===--- Asm String Analysis ---===//
1672 
1673  const StringLiteral *getAsmString() const { return AsmStr; }
1674  StringLiteral *getAsmString() { return AsmStr; }
1675  void setAsmString(StringLiteral *E) { AsmStr = E; }
1676 
1677  /// AsmStringPiece - this is part of a decomposed asm string specification
1678  /// (for use with the AnalyzeAsmString function below). An asm string is
1679  /// considered to be a concatenation of these parts.
1681  public:
1682  enum Kind {
1683  String, // String in .ll asm string form, "$" -> "$$" and "%%" -> "%".
1684  Operand // Operand reference, with optional modifier %c4.
1685  };
1686 
1687  private:
1688  Kind MyKind;
1689  std::string Str;
1690  unsigned OperandNo;
1691 
1692  // Source range for operand references.
1693  CharSourceRange Range;
1694 
1695  public:
1696  AsmStringPiece(const std::string &S) : MyKind(String), Str(S) {}
1697  AsmStringPiece(unsigned OpNo, const std::string &S, SourceLocation Begin,
1699  : MyKind(Operand), Str(S), OperandNo(OpNo),
1700  Range(CharSourceRange::getCharRange(Begin, End)) {}
1701 
1702  bool isString() const { return MyKind == String; }
1703  bool isOperand() const { return MyKind == Operand; }
1704 
1705  const std::string &getString() const { return Str; }
1706 
1707  unsigned getOperandNo() const {
1708  assert(isOperand());
1709  return OperandNo;
1710  }
1711 
1713  assert(isOperand() && "Range is currently used only for Operands.");
1714  return Range;
1715  }
1716 
1717  /// getModifier - Get the modifier for this operand, if present. This
1718  /// returns '\0' if there was no modifier.
1719  char getModifier() const;
1720  };
1721 
1722  /// AnalyzeAsmString - Analyze the asm string of the current asm, decomposing
1723  /// it into pieces. If the asm string is erroneous, emit errors and return
1724  /// true, otherwise return false. This handles canonicalization and
1725  /// translation of strings from GCC syntax to LLVM IR syntax, and handles
1726  //// flattening of named references like %[foo] to Operand AsmStringPiece's.
1727  unsigned AnalyzeAsmString(SmallVectorImpl<AsmStringPiece> &Pieces,
1728  const ASTContext &C, unsigned &DiagOffs) const;
1729 
1730  /// Assemble final IR asm string.
1731  std::string generateAsmString(const ASTContext &C) const;
1732 
1733  //===--- Output operands ---===//
1734 
1735  IdentifierInfo *getOutputIdentifier(unsigned i) const { return Names[i]; }
1736 
1737  StringRef getOutputName(unsigned i) const {
1738  if (IdentifierInfo *II = getOutputIdentifier(i))
1739  return II->getName();
1740 
1741  return {};
1742  }
1743 
1744  StringRef getOutputConstraint(unsigned i) const;
1745 
1746  const StringLiteral *getOutputConstraintLiteral(unsigned i) const {
1747  return Constraints[i];
1748  }
1750  return Constraints[i];
1751  }
1752 
1753  Expr *getOutputExpr(unsigned i);
1754 
1755  const Expr *getOutputExpr(unsigned i) const {
1756  return const_cast<GCCAsmStmt*>(this)->getOutputExpr(i);
1757  }
1758 
1759  //===--- Input operands ---===//
1760 
1761  IdentifierInfo *getInputIdentifier(unsigned i) const {
1762  return Names[i + NumOutputs];
1763  }
1764 
1765  StringRef getInputName(unsigned i) const {
1766  if (IdentifierInfo *II = getInputIdentifier(i))
1767  return II->getName();
1768 
1769  return {};
1770  }
1771 
1772  StringRef getInputConstraint(unsigned i) const;
1773 
1774  const StringLiteral *getInputConstraintLiteral(unsigned i) const {
1775  return Constraints[i + NumOutputs];
1776  }
1778  return Constraints[i + NumOutputs];
1779  }
1780 
1781  Expr *getInputExpr(unsigned i);
1782  void setInputExpr(unsigned i, Expr *E);
1783 
1784  const Expr *getInputExpr(unsigned i) const {
1785  return const_cast<GCCAsmStmt*>(this)->getInputExpr(i);
1786  }
1787 
1788 private:
1789  void setOutputsAndInputsAndClobbers(const ASTContext &C,
1790  IdentifierInfo **Names,
1791  StringLiteral **Constraints,
1792  Stmt **Exprs,
1793  unsigned NumOutputs,
1794  unsigned NumInputs,
1795  StringLiteral **Clobbers,
1796  unsigned NumClobbers);
1797 
1798 public:
1799  //===--- Other ---===//
1800 
1801  /// getNamedOperand - Given a symbolic operand reference like %[foo],
1802  /// translate this into a numeric value needed to reference the same operand.
1803  /// This returns -1 if the operand name is invalid.
1804  int getNamedOperand(StringRef SymbolicName) const;
1805 
1806  StringRef getClobber(unsigned i) const;
1807 
1808  StringLiteral *getClobberStringLiteral(unsigned i) { return Clobbers[i]; }
1809  const StringLiteral *getClobberStringLiteral(unsigned i) const {
1810  return Clobbers[i];
1811  }
1812 
1813  SourceLocation getBeginLoc() const LLVM_READONLY { return AsmLoc; }
1814  SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
1815 
1816  static bool classof(const Stmt *T) {
1817  return T->getStmtClass() == GCCAsmStmtClass;
1818  }
1819 };
1820 
1821 /// This represents a Microsoft inline-assembly statement extension.
1822 class MSAsmStmt : public AsmStmt {
1823  friend class ASTStmtReader;
1824 
1825  SourceLocation LBraceLoc, EndLoc;
1826  StringRef AsmStr;
1827 
1828  unsigned NumAsmToks = 0;
1829 
1830  Token *AsmToks = nullptr;
1831  StringRef *Constraints = nullptr;
1832  StringRef *Clobbers = nullptr;
1833 
1834 public:
1835  MSAsmStmt(const ASTContext &C, SourceLocation asmloc,
1836  SourceLocation lbraceloc, bool issimple, bool isvolatile,
1837  ArrayRef<Token> asmtoks, unsigned numoutputs, unsigned numinputs,
1838  ArrayRef<StringRef> constraints,
1839  ArrayRef<Expr*> exprs, StringRef asmstr,
1840  ArrayRef<StringRef> clobbers, SourceLocation endloc);
1841 
1842  /// Build an empty MS-style inline-assembly statement.
1843  explicit MSAsmStmt(EmptyShell Empty) : AsmStmt(MSAsmStmtClass, Empty) {}
1844 
1845  SourceLocation getLBraceLoc() const { return LBraceLoc; }
1846  void setLBraceLoc(SourceLocation L) { LBraceLoc = L; }
1847  SourceLocation getEndLoc() const { return EndLoc; }
1848  void setEndLoc(SourceLocation L) { EndLoc = L; }
1849 
1850  bool hasBraces() const { return LBraceLoc.isValid(); }
1851 
1852  unsigned getNumAsmToks() { return NumAsmToks; }
1853  Token *getAsmToks() { return AsmToks; }
1854 
1855  //===--- Asm String Analysis ---===//
1856  StringRef getAsmString() const { return AsmStr; }
1857 
1858  /// Assemble final IR asm string.
1859  std::string generateAsmString(const ASTContext &C) const;
1860 
1861  //===--- Output operands ---===//
1862 
1863  StringRef getOutputConstraint(unsigned i) const {
1864  assert(i < NumOutputs);
1865  return Constraints[i];
1866  }
1867 
1868  Expr *getOutputExpr(unsigned i);
1869 
1870  const Expr *getOutputExpr(unsigned i) const {
1871  return const_cast<MSAsmStmt*>(this)->getOutputExpr(i);
1872  }
1873 
1874  //===--- Input operands ---===//
1875 
1876  StringRef getInputConstraint(unsigned i) const {
1877  assert(i < NumInputs);
1878  return Constraints[i + NumOutputs];
1879  }
1880 
1881  Expr *getInputExpr(unsigned i);
1882  void setInputExpr(unsigned i, Expr *E);
1883 
1884  const Expr *getInputExpr(unsigned i) const {
1885  return const_cast<MSAsmStmt*>(this)->getInputExpr(i);
1886  }
1887 
1888  //===--- Other ---===//
1889 
1891  return llvm::makeArrayRef(Constraints, NumInputs + NumOutputs);
1892  }
1893 
1895  return llvm::makeArrayRef(Clobbers, NumClobbers);
1896  }
1897 
1899  return llvm::makeArrayRef(reinterpret_cast<Expr**>(Exprs),
1900  NumInputs + NumOutputs);
1901  }
1902 
1903  StringRef getClobber(unsigned i) const { return getClobbers()[i]; }
1904 
1905 private:
1906  void initialize(const ASTContext &C, StringRef AsmString,
1907  ArrayRef<Token> AsmToks, ArrayRef<StringRef> Constraints,
1908  ArrayRef<Expr*> Exprs, ArrayRef<StringRef> Clobbers);
1909 
1910 public:
1911  SourceLocation getBeginLoc() const LLVM_READONLY { return AsmLoc; }
1912 
1913  static bool classof(const Stmt *T) {
1914  return T->getStmtClass() == MSAsmStmtClass;
1915  }
1916 
1918  return child_range(&Exprs[0], &Exprs[NumInputs + NumOutputs]);
1919  }
1920 };
1921 
1922 class SEHExceptStmt : public Stmt {
1923  friend class ASTReader;
1924  friend class ASTStmtReader;
1925 
1926  SourceLocation Loc;
1927  Stmt *Children[2];
1928 
1929  enum { FILTER_EXPR, BLOCK };
1930 
1931  SEHExceptStmt(SourceLocation Loc, Expr *FilterExpr, Stmt *Block);
1932  explicit SEHExceptStmt(EmptyShell E) : Stmt(SEHExceptStmtClass, E) {}
1933 
1934 public:
1935  static SEHExceptStmt* Create(const ASTContext &C,
1936  SourceLocation ExceptLoc,
1937  Expr *FilterExpr,
1938  Stmt *Block);
1939 
1940  SourceLocation getBeginLoc() const LLVM_READONLY { return getExceptLoc(); }
1941 
1942  SourceLocation getExceptLoc() const { return Loc; }
1943  SourceLocation getEndLoc() const { return getBlock()->getEndLoc(); }
1944 
1945  Expr *getFilterExpr() const {
1946  return reinterpret_cast<Expr*>(Children[FILTER_EXPR]);
1947  }
1948 
1950  return cast<CompoundStmt>(Children[BLOCK]);
1951  }
1952 
1954  return child_range(Children, Children+2);
1955  }
1956 
1957  static bool classof(const Stmt *T) {
1958  return T->getStmtClass() == SEHExceptStmtClass;
1959  }
1960 };
1961 
1962 class SEHFinallyStmt : public Stmt {
1963  friend class ASTReader;
1964  friend class ASTStmtReader;
1965 
1966  SourceLocation Loc;
1967  Stmt *Block;
1968 
1969  SEHFinallyStmt(SourceLocation Loc, Stmt *Block);
1970  explicit SEHFinallyStmt(EmptyShell E) : Stmt(SEHFinallyStmtClass, E) {}
1971 
1972 public:
1973  static SEHFinallyStmt* Create(const ASTContext &C,
1974  SourceLocation FinallyLoc,
1975  Stmt *Block);
1976 
1977  SourceLocation getBeginLoc() const LLVM_READONLY { return getFinallyLoc(); }
1978 
1979  SourceLocation getFinallyLoc() const { return Loc; }
1980  SourceLocation getEndLoc() const { return Block->getEndLoc(); }
1981 
1982  CompoundStmt *getBlock() const { return cast<CompoundStmt>(Block); }
1983 
1985  return child_range(&Block,&Block+1);
1986  }
1987 
1988  static bool classof(const Stmt *T) {
1989  return T->getStmtClass() == SEHFinallyStmtClass;
1990  }
1991 };
1992 
1993 class SEHTryStmt : public Stmt {
1994  friend class ASTReader;
1995  friend class ASTStmtReader;
1996 
1997  bool IsCXXTry;
1998  SourceLocation TryLoc;
1999  Stmt *Children[2];
2000 
2001  enum { TRY = 0, HANDLER = 1 };
2002 
2003  SEHTryStmt(bool isCXXTry, // true if 'try' otherwise '__try'
2004  SourceLocation TryLoc,
2005  Stmt *TryBlock,
2006  Stmt *Handler);
2007 
2008  explicit SEHTryStmt(EmptyShell E) : Stmt(SEHTryStmtClass, E) {}
2009 
2010 public:
2011  static SEHTryStmt* Create(const ASTContext &C, bool isCXXTry,
2012  SourceLocation TryLoc, Stmt *TryBlock,
2013  Stmt *Handler);
2014 
2015  SourceLocation getBeginLoc() const LLVM_READONLY { return getTryLoc(); }
2016 
2017  SourceLocation getTryLoc() const { return TryLoc; }
2018  SourceLocation getEndLoc() const { return Children[HANDLER]->getEndLoc(); }
2019 
2020  bool getIsCXXTry() const { return IsCXXTry; }
2021 
2023  return cast<CompoundStmt>(Children[TRY]);
2024  }
2025 
2026  Stmt *getHandler() const { return Children[HANDLER]; }
2027 
2028  /// Returns 0 if not defined
2029  SEHExceptStmt *getExceptHandler() const;
2030  SEHFinallyStmt *getFinallyHandler() const;
2031 
2033  return child_range(Children, Children+2);
2034  }
2035 
2036  static bool classof(const Stmt *T) {
2037  return T->getStmtClass() == SEHTryStmtClass;
2038  }
2039 };
2040 
2041 /// Represents a __leave statement.
2042 class SEHLeaveStmt : public Stmt {
2043  SourceLocation LeaveLoc;
2044 
2045 public:
2047  : Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}
2048 
2049  /// Build an empty __leave statement.
2050  explicit SEHLeaveStmt(EmptyShell Empty) : Stmt(SEHLeaveStmtClass, Empty) {}
2051 
2052  SourceLocation getLeaveLoc() const { return LeaveLoc; }
2053  void setLeaveLoc(SourceLocation L) { LeaveLoc = L; }
2054 
2055  SourceLocation getBeginLoc() const LLVM_READONLY { return LeaveLoc; }
2056  SourceLocation getEndLoc() const LLVM_READONLY { return LeaveLoc; }
2057 
2058  static bool classof(const Stmt *T) {
2059  return T->getStmtClass() == SEHLeaveStmtClass;
2060  }
2061 
2062  // Iterators
2065  }
2066 };
2067 
2068 /// This captures a statement into a function. For example, the following
2069 /// pragma annotated compound statement can be represented as a CapturedStmt,
2070 /// and this compound statement is the body of an anonymous outlined function.
2071 /// @code
2072 /// #pragma omp parallel
2073 /// {
2074 /// compute();
2075 /// }
2076 /// @endcode
2077 class CapturedStmt : public Stmt {
2078 public:
2079  /// The different capture forms: by 'this', by reference, capture for
2080  /// variable-length array type etc.
2086  };
2087 
2088  /// Describes the capture of either a variable, or 'this', or
2089  /// variable-length array type.
2090  class Capture {
2091  llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
2092  SourceLocation Loc;
2093 
2094  public:
2095  friend class ASTStmtReader;
2096 
2097  /// Create a new capture.
2098  ///
2099  /// \param Loc The source location associated with this capture.
2100  ///
2101  /// \param Kind The kind of capture (this, ByRef, ...).
2102  ///
2103  /// \param Var The variable being captured, or null if capturing this.
2105  VarDecl *Var = nullptr);
2106 
2107  /// Determine the kind of capture.
2108  VariableCaptureKind getCaptureKind() const;
2109 
2110  /// Retrieve the source location at which the variable or 'this' was
2111  /// first used.
2112  SourceLocation getLocation() const { return Loc; }
2113 
2114  /// Determine whether this capture handles the C++ 'this' pointer.
2115  bool capturesThis() const { return getCaptureKind() == VCK_This; }
2116 
2117  /// Determine whether this capture handles a variable (by reference).
2118  bool capturesVariable() const { return getCaptureKind() == VCK_ByRef; }
2119 
2120  /// Determine whether this capture handles a variable by copy.
2121  bool capturesVariableByCopy() const {
2122  return getCaptureKind() == VCK_ByCopy;
2123  }
2124 
2125  /// Determine whether this capture handles a variable-length array
2126  /// type.
2128  return getCaptureKind() == VCK_VLAType;
2129  }
2130 
2131  /// Retrieve the declaration of the variable being captured.
2132  ///
2133  /// This operation is only valid if this capture captures a variable.
2134  VarDecl *getCapturedVar() const;
2135  };
2136 
2137 private:
2138  /// The number of variable captured, including 'this'.
2139  unsigned NumCaptures;
2140 
2141  /// The pointer part is the implicit the outlined function and the
2142  /// int part is the captured region kind, 'CR_Default' etc.
2143  llvm::PointerIntPair<CapturedDecl *, 2, CapturedRegionKind> CapDeclAndKind;
2144 
2145  /// The record for captured variables, a RecordDecl or CXXRecordDecl.
2146  RecordDecl *TheRecordDecl = nullptr;
2147 
2148  /// Construct a captured statement.
2150  ArrayRef<Expr *> CaptureInits, CapturedDecl *CD, RecordDecl *RD);
2151 
2152  /// Construct an empty captured statement.
2153  CapturedStmt(EmptyShell Empty, unsigned NumCaptures);
2154 
2155  Stmt **getStoredStmts() { return reinterpret_cast<Stmt **>(this + 1); }
2156 
2157  Stmt *const *getStoredStmts() const {
2158  return reinterpret_cast<Stmt *const *>(this + 1);
2159  }
2160 
2161  Capture *getStoredCaptures() const;
2162 
2163  void setCapturedStmt(Stmt *S) { getStoredStmts()[NumCaptures] = S; }
2164 
2165 public:
2166  friend class ASTStmtReader;
2167 
2168  static CapturedStmt *Create(const ASTContext &Context, Stmt *S,
2169  CapturedRegionKind Kind,
2170  ArrayRef<Capture> Captures,
2171  ArrayRef<Expr *> CaptureInits,
2172  CapturedDecl *CD, RecordDecl *RD);
2173 
2174  static CapturedStmt *CreateDeserialized(const ASTContext &Context,
2175  unsigned NumCaptures);
2176 
2177  /// Retrieve the statement being captured.
2178  Stmt *getCapturedStmt() { return getStoredStmts()[NumCaptures]; }
2179  const Stmt *getCapturedStmt() const { return getStoredStmts()[NumCaptures]; }
2180 
2181  /// Retrieve the outlined function declaration.
2182  CapturedDecl *getCapturedDecl();
2183  const CapturedDecl *getCapturedDecl() const;
2184 
2185  /// Set the outlined function declaration.
2186  void setCapturedDecl(CapturedDecl *D);
2187 
2188  /// Retrieve the captured region kind.
2189  CapturedRegionKind getCapturedRegionKind() const;
2190 
2191  /// Set the captured region kind.
2192  void setCapturedRegionKind(CapturedRegionKind Kind);
2193 
2194  /// Retrieve the record declaration for captured variables.
2195  const RecordDecl *getCapturedRecordDecl() const { return TheRecordDecl; }
2196 
2197  /// Set the record declaration for captured variables.
2199  assert(D && "null RecordDecl");
2200  TheRecordDecl = D;
2201  }
2202 
2203  /// True if this variable has been captured.
2204  bool capturesVariable(const VarDecl *Var) const;
2205 
2206  /// An iterator that walks over the captures.
2209  using capture_range = llvm::iterator_range<capture_iterator>;
2210  using capture_const_range = llvm::iterator_range<const_capture_iterator>;
2211 
2213  return capture_range(capture_begin(), capture_end());
2214  }
2216  return capture_const_range(capture_begin(), capture_end());
2217  }
2218 
2219  /// Retrieve an iterator pointing to the first capture.
2220  capture_iterator capture_begin() { return getStoredCaptures(); }
2221  const_capture_iterator capture_begin() const { return getStoredCaptures(); }
2222 
2223  /// Retrieve an iterator pointing past the end of the sequence of
2224  /// captures.
2226  return getStoredCaptures() + NumCaptures;
2227  }
2228 
2229  /// Retrieve the number of captures, including 'this'.
2230  unsigned capture_size() const { return NumCaptures; }
2231 
2232  /// Iterator that walks over the capture initialization arguments.
2234  using capture_init_range = llvm::iterator_range<capture_init_iterator>;
2235 
2236  /// Const iterator that walks over the capture initialization
2237  /// arguments.
2239  using const_capture_init_range =
2240  llvm::iterator_range<const_capture_init_iterator>;
2241 
2243  return capture_init_range(capture_init_begin(), capture_init_end());
2244  }
2245 
2247  return const_capture_init_range(capture_init_begin(), capture_init_end());
2248  }
2249 
2250  /// Retrieve the first initialization argument.
2252  return reinterpret_cast<Expr **>(getStoredStmts());
2253  }
2254 
2256  return reinterpret_cast<Expr *const *>(getStoredStmts());
2257  }
2258 
2259  /// Retrieve the iterator pointing one past the last initialization
2260  /// argument.
2262  return capture_init_begin() + NumCaptures;
2263  }
2264 
2266  return capture_init_begin() + NumCaptures;
2267  }
2268 
2269  SourceLocation getBeginLoc() const LLVM_READONLY {
2270  return getCapturedStmt()->getBeginLoc();
2271  }
2272 
2273  SourceLocation getEndLoc() const LLVM_READONLY {
2274  return getCapturedStmt()->getEndLoc();
2275  }
2276 
2277  SourceRange getSourceRange() const LLVM_READONLY {
2278  return getCapturedStmt()->getSourceRange();
2279  }
2280 
2281  static bool classof(const Stmt *T) {
2282  return T->getStmtClass() == CapturedStmtClass;
2283  }
2284 
2286 };
2287 
2288 } // namespace clang
2289 
2290 #endif // LLVM_CLANG_AST_STMT_H
SourceLocation getRParenLoc() const
Definition: Stmt.h:1215
child_iterator child_begin()
Definition: Stmt.h:470
Expr * getInc()
Definition: Stmt.h:1268
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1113
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1518
void setThen(Stmt *S)
Definition: Stmt.h:998
GotoStmt(EmptyShell Empty)
Build an empty goto statement.
Definition: Stmt.h:1315
SourceLocation getRBracLoc() const
Definition: Stmt.h:704
APFloatSemantics
Definition: Stmt.h:159
IdentifierInfo * getInputIdentifier(unsigned i) const
Definition: Stmt.h:1761
DoStmt(Stmt *body, Expr *cond, SourceLocation DL, SourceLocation WL, SourceLocation RP)
Definition: Stmt.h:1193
static bool classof(const Stmt *T)
Definition: Stmt.h:1031
child_range children()
Definition: Stmt.h:1119
SourceLocation getRParenLoc() const
Definition: Stmt.h:1668
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:1647
Stmt * body_back()
Definition: Stmt.h:649
const Stmt * getElse() const
Definition: Stmt.h:999
body_iterator body_end()
Definition: Stmt.h:646
unsigned getNumInputs() const
Definition: Stmt.h:1563
CompoundStmt * getBlock() const
Definition: Stmt.h:1982
SourceLocation getForLoc() const
Definition: Stmt.h:1281
const Stmt * getBody() const
Definition: Stmt.h:1207
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument.
Definition: Stmt.h:2251
capture_const_range captures() const
Definition: Stmt.h:2215
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:701
const_child_iterator child_end() const
Definition: Stmt.h:474
ConstExprIterator(const Stmt *const *I)
Definition: Stmt.h:364
DefaultStmt(SourceLocation DL, SourceLocation CL, Stmt *substmt)
Definition: Stmt.h:827
SourceLocation getEllipsisLoc() const
Definition: Stmt.h:779
void setNRVOCandidate(const VarDecl *Var)
Definition: Stmt.h:1472
static bool classof(const Stmt *T)
Definition: Stmt.h:1913
Expr * getCond()
Definition: Stmt.h:1158
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
Definition: opencl-c.h:60
inputs_range inputs()
Definition: Stmt.h:1596
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2372
void setCond(Expr *E)
Definition: Stmt.h:1160
unsigned getNumAsmToks()
Definition: Stmt.h:1852
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:30
const_reverse_body_iterator body_rbegin() const
Definition: Stmt.h:692
outputs_iterator end_outputs()
Definition: Stmt.h:1621
const DeclStmt * getConditionVariableDeclStmt() const
If this ForStmt has a condition variable, return the faux DeclStmt associated with the creation of th...
Definition: Stmt.h:1263
IndirectGotoStmt(EmptyShell Empty)
Build an empty indirect goto statement.
Definition: Stmt.h:1351
std::reverse_iterator< const_body_iterator > const_reverse_body_iterator
Definition: Stmt.h:690
Stmt - This represents one statement.
Definition: Stmt.h:66
IfStmt - This represents an if/then/else.
Definition: Stmt.h:959
AsmStmt(StmtClass SC, EmptyShell Empty)
Build an empty inline-assembly statement.
Definition: Stmt.h:1520
bool capturesThis() const
Determine whether this capture handles the C++ &#39;this&#39; pointer.
Definition: Stmt.h:2115
unsigned getNumOutputs() const
Definition: Stmt.h:1541
llvm::iterator_range< body_iterator > body_range
Definition: Stmt.h:642
ContinueStmt(EmptyShell Empty)
Build an empty continue statement.
Definition: Stmt.h:1389
const StringLiteral * getAsmString() const
Definition: Stmt.h:1673
void setRParenLoc(SourceLocation L)
Definition: Stmt.h:1669
void setContinueLoc(SourceLocation L)
Definition: Stmt.h:1392
iterator end()
Definition: DeclGroup.h:106
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:87
void setDeclGroup(DeclGroupRef DGR)
Definition: Stmt.h:527
bool hasLeadingEmptyMacro() const
Definition: Stmt.h:598
FloatingLiteralBitfields FloatingLiteralBits
Definition: Stmt.h:302
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:843
NullStmt(EmptyShell Empty)
Build an empty null statement.
Definition: Stmt.h:593
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:802
const Expr * getOutputExpr(unsigned i) const
Definition: Stmt.h:1870
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:889
SourceLocation getIdentLoc() const
Definition: Stmt.h:880
Represents an attribute applied to a statement.
Definition: Stmt.h:905
const Expr * getOutputExpr(unsigned i) const
Definition: Stmt.h:1755
void setCond(Expr *E)
Definition: Stmt.h:1205
llvm::iterator_range< child_iterator > child_range
Definition: Stmt.h:460
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
Definition: Stmt.h:2195
DeclRefExprBitfields DeclRefExprBits
Definition: Stmt.h:304
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1262
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:533
unsigned NumOutputs
Definition: Stmt.h:1506
bool getIsCXXTry() const
Definition: Stmt.h:2020
child_range children()
Definition: Stmt.h:2063
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
void setSwitchCaseList(SwitchCase *SC)
Set the case list for this switch statement.
Definition: Stmt.h:1086
NullStmt(SourceLocation L, bool hasLeadingEmptyMacro=false)
Definition: Stmt.h:588
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1394
void setStartLoc(SourceLocation L)
Definition: Stmt.h:529
SourceLocation getGotoLoc() const
Definition: Stmt.h:1355
void setForLoc(SourceLocation L)
Definition: Stmt.h:1282
WhileStmt(EmptyShell Empty)
Build an empty while statement.
Definition: Stmt.h:1139
const_child_iterator child_begin() const
Definition: Stmt.h:473
Stmt * getSubStmt()
Definition: Stmt.h:834
Represents a variable declaration or definition.
Definition: Decl.h:812
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization. ...
Definition: Stmt.h:1471
SourceLocation getLParenLoc() const
Definition: Stmt.h:1283
static bool classof(const Stmt *T)
Definition: Stmt.h:706
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:946
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1423
void setInit(Stmt *S)
Definition: Stmt.h:994
void setAsmLoc(SourceLocation L)
Definition: Stmt.h:1523
ExprIterator(Stmt **I)
Definition: Stmt.h:349
const_outputs_iterator begin_outputs() const
Definition: Stmt.h:1629
const Expr * getCond() const
Definition: Stmt.h:1272
Stmt * getThen()
Definition: Stmt.h:1003
SourceLocation getIfLoc() const
Definition: Stmt.h:1006
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:38
capture_iterator capture_begin()
Retrieve an iterator pointing to the first capture.
Definition: Stmt.h:2220
static StringRef bytes(const std::vector< T, Allocator > &v)
Definition: ASTWriter.cpp:120
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Definition: ExprCXX.h:3033
llvm::iterator_range< decl_iterator > decl_range
Definition: Stmt.h:547
StringRef getInputName(unsigned i) const
Definition: Stmt.h:1765
std::string getName(ArrayRef< StringRef > Parts) const
Get the platform-specific name separator.
void setBody(Stmt *S, SourceLocation SL)
Definition: Stmt.h:1091
Stmt(StmtClass SC, EmptyShell)
Construct an empty statement.
Definition: Stmt.h:379
void setTarget(Expr *E)
Definition: Stmt.h:1361
CoawaitExprBitfields CoawaitBits
Definition: Stmt.h:313
static bool classof(const Stmt *T)
Definition: Stmt.h:2036
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:864
Represents a struct/union/class.
Definition: Decl.h:3585
Represents a C99 designated initializer expression.
Definition: Expr.h:4234
const Expr * getTarget() const
Definition: Stmt.h:1360
inputs_iterator begin_inputs()
Definition: Stmt.h:1588
SourceLocation getColonLoc() const
Definition: Stmt.h:840
One of these records is kept for each identifier that is lexed.
Stmt * getBody()
Definition: Stmt.h:1206
const_outputs_iterator end_outputs() const
Definition: Stmt.h:1633
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:3661
SourceLocation ColonLoc
Definition: Stmt.h:725
DeclGroupRef::const_iterator const_decl_iterator
Definition: Stmt.h:546
void setInit(Stmt *S)
Definition: Stmt.h:1074
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:154
child_range children()
Definition: Stmt.h:1984
const_body_iterator body_begin() const
Definition: Stmt.h:665
SourceLocation getEndLoc() const
Definition: Stmt.h:530
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:2055
LabelStmt(SourceLocation IL, LabelDecl *D, Stmt *substmt)
Definition: Stmt.h:870
CharSourceRange getRange() const
Definition: Stmt.h:1712
CharacterLiteralBitfields CharacterLiteralBits
Definition: Stmt.h:301
ArrayRef< Expr * > getAllExprs() const
Definition: Stmt.h:1898
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:2015
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1531
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1325
SourceLocation getEndLoc() const
Definition: Stmt.h:2018
Token - This structure provides full information about a lexed token.
Definition: Token.h:35
ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits
Definition: Stmt.h:310
Stmt * body_front()
Definition: Stmt.h:647
void setReturnLoc(SourceLocation L)
Definition: Stmt.h:1464
llvm::iterator_range< const_inputs_iterator > inputs_const_range
Definition: Stmt.h:1586
MSAsmStmt(EmptyShell Empty)
Build an empty MS-style inline-assembly statement.
Definition: Stmt.h:1843
const DeclGroupRef getDeclGroup() const
Definition: Stmt.h:525
bool isAllEnumCasesCovered() const
Returns true if the SwitchStmt is a switch of an enum value and all cases have been explicitly covere...
Definition: Stmt.h:1109
static bool classof(const Stmt *T)
Definition: Stmt.h:1576
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
Definition: ExprObjC.h:171
child_range children()
Definition: Stmt.h:1917
void setSubStmt(Stmt *S)
Definition: Stmt.h:798
child_range children()
Definition: Stmt.h:1226
SwitchCase(StmtClass SC, SourceLocation KWLoc, SourceLocation ColonLoc)
Definition: Stmt.h:727
const Stmt * getSubStmt() const
Definition: Stmt.h:885
void addSwitchCase(SwitchCase *SC)
Definition: Stmt.h:1096
child_range children()
Definition: Stmt.h:607
child_range children()
Definition: Stmt.h:2032
void setBody(Stmt *S)
Definition: Stmt.h:1082
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:2056
static bool classof(const Stmt *T)
Definition: Stmt.h:1174
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:1339
Describes an C or C++ initializer list.
Definition: Expr.h:4000
SwitchCase(StmtClass SC, EmptyShell)
Definition: Stmt.h:730
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
Definition: Stmt.h:2238
GCCAsmStmt(EmptyShell Empty)
Build an empty inline-assembly statement.
Definition: Stmt.h:1666
child_range children()
Definition: Stmt.h:951
ForStmt - This represents a &#39;for (init;cond;inc)&#39; stmt.
Definition: Stmt.h:1234
outputs_iterator begin_outputs()
Definition: Stmt.h:1617
void setCond(Expr *E)
Definition: Stmt.h:1080
Decl * getSingleDecl()
Definition: DeclGroup.h:84
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:947
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
LabelDecl * getDecl() const
Definition: Stmt.h:881
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SourceLocation getLBracLoc() const
Definition: Stmt.h:703
void setEndLoc(SourceLocation L)
Definition: Stmt.h:531
DeclStmt(EmptyShell Empty)
Build an empty declaration statement.
Definition: Stmt.h:514
Stmt * getBody()
Definition: Stmt.h:1269
llvm::iterator_range< const_outputs_iterator > outputs_const_range
Definition: Stmt.h:1615
Stmt * getInit()
Definition: Stmt.h:1248
iterator begin()
Definition: DeclGroup.h:100
const StringLiteral * getInputConstraintLiteral(unsigned i) const
Definition: Stmt.h:1774
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1911
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:890
child_range children()
Definition: Stmt.h:894
void setAsmString(StringLiteral *E)
Definition: Stmt.h:1675
static bool classof(const Stmt *T)
Definition: Stmt.h:1480
AsmStmt(StmtClass SC, SourceLocation asmloc, bool issimple, bool isvolatile, unsigned numoutputs, unsigned numinputs, unsigned numclobbers)
Definition: Stmt.h:1512
const Stmt * getInit() const
Definition: Stmt.h:1073
const Expr * getInc() const
Definition: Stmt.h:1273
Expr * getCond()
Definition: Stmt.h:1267
SourceLocation getContinueLoc() const
Definition: Stmt.h:1391
void setLHS(Expr *Val)
Definition: Stmt.h:799
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:2795
void setBody(Stmt *S)
Definition: Stmt.h:1163
StringLiteral * getClobberStringLiteral(unsigned i)
Definition: Stmt.h:1808
StringRef getOutputName(unsigned i) const
Definition: Stmt.h:1737
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1170
void setCond(Expr *E)
Definition: Stmt.h:1277
bool isOutputPlusConstraint(unsigned i) const
isOutputPlusConstraint - Return true if the specified output constraint is a "+" constraint (which is...
Definition: Stmt.h:1551
decl_iterator decl_end()
Definition: Stmt.h:557
const Expr * getCond() const
Definition: Stmt.h:1159
SourceLocation getTryLoc() const
Definition: Stmt.h:2017
void setEndLoc(SourceLocation L)
Definition: Stmt.h:1848
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3243
child_range children()
Definition: Stmt.h:711
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4036
StmtClass
Definition: Stmt.h:68
Stmt * getBody()
Definition: Stmt.h:1081
const Expr * getLHS() const
Definition: Stmt.h:788
Stmt * getInit()
Definition: Stmt.h:992
const_body_iterator body_end() const
Definition: Stmt.h:669
Iterator for iterating over Stmt * arrays that contain only Expr *.
Definition: Stmt.h:345
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1476
unsigned NumClobbers
Definition: Stmt.h:1508
const_decl_iterator decl_begin() const
Definition: Stmt.h:558
StringLiteral * getAsmString()
Definition: Stmt.h:1674
StmtBitfields StmtBits
Definition: Stmt.h:297
Const iterator for iterating over Stmt * arrays that contain only Expr *.
Definition: Stmt.h:359
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1395
void setColonLoc(SourceLocation L)
Definition: Stmt.h:841
child_range children()
Definition: Stmt.h:818
llvm::iterator_range< const_child_iterator > const_child_range
Definition: Stmt.h:461
void setBreakLoc(SourceLocation L)
Definition: Stmt.h:1421
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:613
Describes the capture of either a variable, or &#39;this&#39;, or variable-length array type.
Definition: Stmt.h:2090
Stmt * stripLabelLikeStatements()
Definition: Stmt.h:449
Decl * getSingleDecl()
Definition: Stmt.h:523
static bool classof(const Stmt *T)
Definition: Stmt.h:1373
const_inputs_iterator begin_inputs() const
Definition: Stmt.h:1598
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1016
void setSemiLoc(SourceLocation L)
Definition: Stmt.h:596
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1940
child_range children()
Definition: Stmt.h:1641
bool IsVolatile
If true, treat this inline assembly as having side effects.
Definition: Stmt.h:1504
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2112
static bool classof(const Stmt *T)
Definition: Stmt.h:1957
static bool classof(const Stmt *T)
Definition: Stmt.h:1294
bool isConstexpr() const
Definition: Stmt.h:1011
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1018
unsigned getOperandNo() const
Definition: Stmt.h:1707
const DeclStmt * getConditionVariableDeclStmt() const
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
Definition: Stmt.h:988
SourceLocation getLabelLoc() const
Definition: Stmt.h:1322
llvm::iterator_range< const_capture_iterator > capture_const_range
Definition: Stmt.h:2210
void setLeaveLoc(SourceLocation L)
Definition: Stmt.h:2053
const Stmt * getSubStmt() const
Definition: Stmt.h:944
const Stmt * getSubStmt() const
Definition: Stmt.h:835
void setRParenLoc(SourceLocation L)
Definition: Stmt.h:1216
SourceLocation getFinallyLoc() const
Definition: Stmt.h:1979
GotoStmt(LabelDecl *label, SourceLocation GL, SourceLocation LL)
Definition: Stmt.h:1311
This represents one expression.
Definition: Expr.h:105
SourceRange getSourceRange() const LLVM_READONLY
Definition: Stmt.h:2277
SourceLocation getElseLoc() const
Definition: Stmt.h:1008
SourceLocation End
void setWhileLoc(SourceLocation L)
Definition: Stmt.h:1166
Represents a character-granular source range.
inputs_const_range inputs() const
Definition: Stmt.h:1606
llvm::iterator_range< const_capture_init_iterator > const_capture_init_range
Definition: Stmt.h:2240
ArrayRef< StringRef > getClobbers() const
Definition: Stmt.h:1894
std::string Label
InitListExprBitfields InitListExprBits
Definition: Stmt.h:311
static bool classof(const Stmt *T)
Definition: Stmt.h:2058
StringRef getClobber(unsigned i) const
Definition: Stmt.h:1903
SourceLocation getDefaultLoc() const
Definition: Stmt.h:838
void setLParenLoc(SourceLocation L)
Definition: Stmt.h:1284
const StringLiteral * getClobberStringLiteral(unsigned i) const
Definition: Stmt.h:1809
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:804
SourceLocation getWhileLoc() const
Definition: Stmt.h:1165
const Stmt * getThen() const
Definition: Stmt.h:997
AsmStringPiece - this is part of a decomposed asm string specification (for use with the AnalyzeAsmSt...
Definition: Stmt.h:1680
const Expr * getInputExpr(unsigned i) const
Definition: Stmt.h:1784
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1290
const Stmt * getCapturedStmt() const
Definition: Stmt.h:2179
void setInc(Expr *E)
Definition: Stmt.h:1278
Stmt * getBody()
Definition: Stmt.h:1161
SourceLocation KeywordLoc
Definition: Stmt.h:724
void setRetValue(Expr *E)
Definition: Stmt.h:1461
void setBody(Stmt *S)
Definition: Stmt.h:1279
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:288
Expr * getRHS()
Definition: Stmt.h:785
ExprBitfields ExprBits
Definition: Stmt.h:300
void setColonLoc(SourceLocation L)
Definition: Stmt.h:782
SourceLocation Begin
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1219
child_range children()
Definition: Stmt.h:1027
unsigned size() const
Definition: Stmt.h:639
ExprWithCleanupsBitfields ExprWithCleanupsBits
Definition: Stmt.h:307
std::reverse_iterator< body_iterator > reverse_body_iterator
Definition: Stmt.h:679
static bool classof(const Stmt *T)
Definition: Stmt.h:603
CompoundStmtBitfields CompoundStmtBits
Definition: Stmt.h:298
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
capture_init_range capture_inits()
Definition: Stmt.h:2242
static OMPLinearClause * CreateEmpty(const ASTContext &C, unsigned NumVars)
Creates an empty clause with the place for NumVars variables.
AsmStringPiece(const std::string &S)
Definition: Stmt.h:1696
ForStmt(EmptyShell Empty)
Build an empty for statement.
Definition: Stmt.h:1246
SourceLocation getSwitchLoc() const
Definition: Stmt.h:1088
StringLiteral * getOutputConstraintLiteral(unsigned i)
Definition: Stmt.h:1749
LabelDecl * getLabel() const
Definition: Stmt.h:1317
child_range children()
Definition: Stmt.h:1378
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
Definition: Stmt.h:1444
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:904
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:1822
void setColonLoc(SourceLocation L)
Definition: Stmt.h:742
SourceLocation getDoLoc() const
Definition: Stmt.h:1210
SwitchCase * getSwitchCaseList()
Definition: Stmt.h:1083
llvm::iterator_range< const_decl_iterator > decl_const_range
Definition: Stmt.h:548
child_range children()
Definition: Stmt.h:853
child_range children()
Definition: Stmt.h:1402
Expr * getCond()
Definition: Stmt.h:1002
static bool classof(const Stmt *T)
Definition: Stmt.h:1328
Stmt *const * const_body_iterator
Definition: Stmt.h:658
const SourceManager & SM
Definition: Format.cpp:1490
const_inputs_iterator end_inputs() const
Definition: Stmt.h:1602
const Expr * getCond() const
Definition: Stmt.h:1204
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.cpp:293
DoStmt - This represents a &#39;do/while&#39; stmt.
Definition: Stmt.h:1185
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition: Stmt.h:1492
child_range children()
Definition: Stmt.h:1431
std::reverse_iterator< decl_iterator > reverse_decl_iterator
Definition: Stmt.h:561
const Stmt * IgnoreContainers(bool IgnoreCaptured=false) const
Definition: Stmt.h:444
SourceLocation getEndLoc() const
Definition: Stmt.h:1943
OpaqueValueExprBitfields OpaqueValueExprBits
Definition: Stmt.h:309
llvm::DOTGraphTraits< ExplodedGraph * > DefaultDOTGraphTraits const ExplodedNode const ExplodedNode *Out<< "\l\|";Out<< "StateID: ST"<< State-> getID()<< "
decl_const_range decls() const
Definition: Stmt.h:552
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Definition: Expr.h:879
void setDecl(LabelDecl *D)
Definition: Stmt.h:882
static bool classof(const Stmt *T)
Definition: Stmt.h:2281
Kind
void setElse(Stmt *S)
Definition: Stmt.h:1000
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
Definition: ExprCXX.h:2581
This captures a statement into a function.
Definition: Stmt.h:2077
Token * getAsmToks()
Definition: Stmt.h:1853
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:5101
void setSubStmt(Stmt *S)
Definition: Stmt.h:836
void setGotoLoc(SourceLocation L)
Definition: Stmt.h:1354
CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc, SourceLocation ellipsisLoc, SourceLocation colonLoc)
Definition: Stmt.h:765
Encodes a location in the source.
body_range body()
Definition: Stmt.h:644
StringRef getOutputConstraint(unsigned i) const
Definition: Stmt.h:1863
PseudoObjectExprBitfields PseudoObjectExprBits
Definition: Stmt.h:308
IfStmtBitfields IfStmtBits
Definition: Stmt.h:299
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1218
SEHLeaveStmt(EmptyShell Empty)
Build an empty __leave statement.
Definition: Stmt.h:2050
const SwitchCase * getSwitchCaseList() const
Definition: Stmt.h:1077
void setDoLoc(SourceLocation L)
Definition: Stmt.h:1211
child_range children()
Definition: Stmt.h:1953
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:1873
Expr * getLHS()
Definition: Stmt.h:784
void setLastStmt(Stmt *S)
Definition: Stmt.h:653
ArrayRef< const Attr * > getAttrs() const
Definition: Stmt.h:939
void setConstexpr(bool C)
Definition: Stmt.h:1012
SourceLocation getExceptLoc() const
Definition: Stmt.h:1942
const_capture_iterator capture_begin() const
Definition: Stmt.h:2221
void setIdentLoc(SourceLocation L)
Definition: Stmt.h:886
Stmt * getElse()
Definition: Stmt.h:1004
const_child_range children() const
Definition: Stmt.h:713
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Definition: Stmt.h:505
Represents the declaration of a label.
Definition: Decl.h:468
bool capturesVariable() const
Determine whether this capture handles a variable (by reference).
Definition: Stmt.h:2118
reverse_body_iterator body_rend()
Definition: Stmt.h:685
SourceLocation getLBraceLoc() const
Definition: Stmt.h:1845
const std::string & getString() const
Definition: Stmt.h:1705
CaseStmt(EmptyShell Empty)
Build an empty switch case statement.
Definition: Stmt.h:775
Expr * getCond()
Definition: Stmt.h:1079
void setAllEnumCasesCovered()
Set a flag in the SwitchStmt indicating that if the &#39;switch (X)&#39; is a switch over an enum value then ...
Definition: Stmt.h:1105
CompoundStmt(SourceLocation Loc)
Definition: Stmt.h:630
void setCond(Expr *E)
Definition: Stmt.h:996
reference operator*() const
Definition: Stmt.h:351
static bool classof(const Stmt *T)
Definition: Stmt.h:1426
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
Definition: Expr.h:5235
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1813
decl_iterator decl_begin()
Definition: Stmt.h:556
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1977
SourceLocation getGotoLoc() const
Definition: Stmt.h:1320
reverse_decl_iterator decl_rbegin()
Definition: Stmt.h:563
SEHLeaveStmt(SourceLocation LL)
Definition: Stmt.h:2046
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
Definition: Stmt.h:1746
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:2929
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition: Stmt.h:2178
const Stmt * body_front() const
Definition: Stmt.h:671
unsigned capture_size() const
Retrieve the number of captures, including &#39;this&#39;.
Definition: Stmt.h:2230
const Stmt * getBody() const
Definition: Stmt.h:1274
void setCaseLoc(SourceLocation L)
Definition: Stmt.h:778
SourceLocation getEndLoc() const
Definition: Stmt.h:1847
LabelStmt(EmptyShell Empty)
Definition: Stmt.h:878
const_capture_init_range capture_inits() const
Definition: Stmt.h:2246
SourceLocation getKeywordLoc() const
Definition: Stmt.h:739
SourceLocation getStarLoc() const
Definition: Stmt.h:1357
const DeclStmt * getConditionVariableDeclStmt() const
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
Definition: Stmt.h:1154
void setCapturedRecordDecl(RecordDecl *D)
Set the record declaration for captured variables.
Definition: Stmt.h:2198
A placeholder type used to construct an empty shell of a type, that will be filled in later (e...
Definition: Stmt.h:338
void setSimple(bool V)
Definition: Stmt.h:1526
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:2887
IfStmt(EmptyShell Empty)
Build an empty if/then/else statement.
Definition: Stmt.h:973
const_child_range children() const
Definition: Stmt.h:465
void setGotoLoc(SourceLocation L)
Definition: Stmt.h:1321
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:574
StringRef getInputConstraint(unsigned i) const
Definition: Stmt.h:1876
Dataflow Directional Tag Classes.
bool isValid() const
Return true if this is a valid SourceLocation object.
bool isVolatile() const
Definition: Stmt.h:1528
child_range children()
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1111
IdentifierInfo * getOutputIdentifier(unsigned i) const
Definition: Stmt.h:1735
bool isSimple() const
Definition: Stmt.h:1525
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:749
llvm::iterator_range< outputs_iterator > outputs_range
Definition: Stmt.h:1614
SourceRange getSourceRange(const SourceRange &Range)
Returns the SourceRange of a SourceRange.
Definition: FixIt.h:34
const Stmt * body_back() const
Definition: Stmt.h:675
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:355
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:844
static bool classof(const Stmt *T)
Definition: Stmt.h:752
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:600
DoStmt(EmptyShell Empty)
Build an empty do-while statement.
Definition: Stmt.h:1201
Stmt * getHandler() const
Definition: Stmt.h:2026
SourceLocation getSemiLoc() const
Definition: Stmt.h:595
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:601
StmtClass getStmtClass() const
Definition: Stmt.h:391
reference operator*() const
Definition: Stmt.h:366
SwitchCase * getNextSwitchCase()
Definition: Stmt.h:735
bool isSingleDecl() const
Definition: DeclGroup.h:81
static bool classof(const Stmt *T)
Definition: Stmt.h:1988
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:2273
void setEllipsisLoc(SourceLocation L)
Definition: Stmt.h:780
const Decl * getSingleDecl() const
Definition: Stmt.h:522
ReturnStmt(SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
Definition: Stmt.h:1452
static bool classof(const Stmt *T)
Definition: Stmt.h:1816
BreakStmt(EmptyShell Empty)
Build an empty break statement.
Definition: Stmt.h:1418
child_range children()
Definition: Stmt.h:1333
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:2269
const Stmt * getSubStmt() const
Definition: Stmt.h:745
Stmt(StmtClass SC)
Definition: Stmt.h:382
bool isSingleDecl() const
isSingleDecl - This method returns true if this DeclStmt refers to a single Decl. ...
Definition: Stmt.h:518
body_iterator body_begin()
Definition: Stmt.h:645
static bool classof(const Stmt *T)
Definition: Stmt.h:535
void setBody(Stmt *S)
Definition: Stmt.h:1208
IndirectGotoStmt(SourceLocation gotoLoc, SourceLocation starLoc, Expr *target)
Definition: Stmt.h:1345
const Stmt * getBody() const
Definition: Stmt.h:1076
llvm::iterator_range< const_body_iterator > body_const_range
Definition: Stmt.h:659
Represents a __leave statement.
Definition: Stmt.h:2042
bool capturesVariableByCopy() const
Determine whether this capture handles a variable by copy.
Definition: Stmt.h:2121
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:1037
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:700
bool body_empty() const
Definition: Stmt.h:638
SourceLocation getLeaveLoc() const
Definition: Stmt.h:2052
bool hasBraces() const
Definition: Stmt.h:1850
const_capture_init_iterator capture_init_end() const
Definition: Stmt.h:2265
void setRHS(Expr *Val)
Definition: Stmt.h:800
void setVolatile(bool V)
Definition: Stmt.h:1529
friend TrailingObjects
Definition: OpenMPClause.h:99
static bool classof(const Stmt *T)
Definition: Stmt.h:896
DefaultStmt(EmptyShell Empty)
Build an empty default statement.
Definition: Stmt.h:831
reverse_decl_iterator decl_rend()
Definition: Stmt.h:567
StringLiteral * getInputConstraintLiteral(unsigned i)
Definition: Stmt.h:1777
DeclGroupRef getDeclGroup()
Definition: Stmt.h:526
Represents a &#39;co_await&#39; expression.
Definition: ExprCXX.h:4340
const Expr * getInputExpr(unsigned i) const
Definition: Stmt.h:1884
TypeTraitExprBitfields TypeTraitExprBits
Definition: Stmt.h:312
void setSwitchLoc(SourceLocation L)
Definition: Stmt.h:1089
Stmt * getInit()
Definition: Stmt.h:1072
const Stmt * IgnoreImplicit() const
Definition: Stmt.h:437
static bool classof(const Stmt *T)
Definition: Stmt.h:848
decl_range decls()
Definition: Stmt.h:550
AsmStringPiece(unsigned OpNo, const std::string &S, SourceLocation Begin, SourceLocation End)
Definition: Stmt.h:1697
bool IsSimple
True if the assembly statement does not have any input or output operands.
Definition: Stmt.h:1500
static bool classof(const Stmt *T)
Definition: Stmt.h:953
StringRef getAsmString() const
Definition: Stmt.h:1856
ArrayRef< StringRef > getAllConstraints() const
Definition: Stmt.h:1890
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1371
UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits
Definition: Stmt.h:303
SourceLocation getColonLoc() const
Definition: Stmt.h:741
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1168
unsigned getNumClobbers() const
Definition: Stmt.h:1573
ReturnStmt(SourceLocation RL)
Definition: Stmt.h:1450
SourceLocation getRParenLoc() const
Definition: Stmt.h:1285
child_range children()
Definition: Stmt.h:1179
void setStarLoc(SourceLocation L)
Definition: Stmt.h:1356
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3122
SourceLocation getAsmLoc() const
Definition: Stmt.h:1522
outputs_range outputs()
Definition: Stmt.h:1625
GotoStmt - This represents a direct goto.
Definition: Stmt.h:1305
Expr * getTarget()
Definition: Stmt.h:1359
Decl *const * const_iterator
Definition: DeclGroup.h:78
const SwitchCase * getNextSwitchCase() const
Definition: Stmt.h:733
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1288
SwitchStmt(EmptyShell Empty)
Build a empty switch statement.
Definition: Stmt.h:1052
Expr * getCond()
Definition: Stmt.h:1203
static bool classof(const Stmt *T)
Definition: Stmt.h:1221
llvm::iterator_range< capture_iterator > capture_range
Definition: Stmt.h:2209
SourceLocation getWhileLoc() const
Definition: Stmt.h:1212
Defines the clang::SourceLocation class and associated facilities.
llvm::iterator_range< inputs_iterator > inputs_range
Definition: Stmt.h:1585
ContinueStmt - This represents a continue.
Definition: Stmt.h:1382
const_decl_iterator decl_end() const
Definition: Stmt.h:559
const Expr * getRHS() const
Definition: Stmt.h:792
reverse_body_iterator body_rbegin()
Definition: Stmt.h:681
void setLBraceLoc(SourceLocation L)
Definition: Stmt.h:1846
child_range children()
Definition: Stmt.h:540
Expr * getFilterExpr() const
Definition: Stmt.h:1945
void setElseLoc(SourceLocation L)
Definition: Stmt.h:1009
SourceLocation getAttrLoc() const
Definition: Stmt.h:938
ContinueStmt(SourceLocation CL)
Definition: Stmt.h:1386
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1370
const Stmt * getInit() const
Definition: Stmt.h:1271
OpenMPLinearClauseKind getModifier() const
Return modifier.
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:1129
llvm::iterator_range< capture_init_iterator > capture_init_range
Definition: Stmt.h:2234
void setIfLoc(SourceLocation L)
Definition: Stmt.h:1007
SourceLocation AsmLoc
Definition: Stmt.h:1496
static bool classof(const Stmt *T)
Definition: Stmt.h:1397
const Stmt * getSubStmt() const
Definition: Stmt.h:796
void setDefaultLoc(SourceLocation L)
Definition: Stmt.h:839
SourceLocation getBreakLoc() const
Definition: Stmt.h:1420
SourceLocation getCaseLoc() const
Definition: Stmt.h:777
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of captures.
Definition: Stmt.h:2225
VariableCaptureKind
The different capture forms: by &#39;this&#39;, by reference, capture for variable-length array type etc...
Definition: Stmt.h:2081
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1573
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2290
static bool classof(const Stmt *T)
Definition: Stmt.h:1123
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1532
void setRParenLoc(SourceLocation L)
Definition: Stmt.h:1286
void setNextSwitchCase(SwitchCase *SC)
Definition: Stmt.h:737
void initialize(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema)
child_range children()
Definition: Stmt.h:1299
body_const_range body() const
Definition: Stmt.h:661
capture_range captures()
Definition: Stmt.h:2212
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:976
SourceLocation getColonLoc() const
Definition: Stmt.h:781
void setLabel(LabelDecl *D)
Definition: Stmt.h:1318
static bool classof(const Stmt *T)
Definition: Stmt.h:813
BreakStmt - This represents a break.
Definition: Stmt.h:1408
const Stmt * getInit() const
Definition: Stmt.h:993
void setSubStmt(Stmt *SS)
Definition: Stmt.h:887
CallExprBitfields CallExprBits
Definition: Stmt.h:306
CapturedRegionKind
The different kinds of captured statement.
Definition: CapturedStmt.h:17
const Stmt * getBody() const
Definition: Stmt.h:1162
CastExprBitfields CastExprBits
Definition: Stmt.h:305
Stmt * getSubStmt()
Definition: Stmt.h:884
DeclStmt(DeclGroupRef dg, SourceLocation startLoc, SourceLocation endLoc)
Definition: Stmt.h:510
const Expr * getCond() const
Definition: Stmt.h:995
A trivial tuple used to represent a source range.
void setInit(Stmt *S)
Definition: Stmt.h:1276
unsigned NumInputs
Definition: Stmt.h:1507
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
Definition: Expr.h:2007
const_reverse_body_iterator body_rend() const
Definition: Stmt.h:696
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1814
const Expr * getCond() const
Definition: Stmt.h:1075
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument.
Definition: Stmt.h:2261
SourceLocation ColonLoc
Location of &#39;:&#39;.
Definition: OpenMPClause.h:108
void setWhileLoc(SourceLocation L)
Definition: Stmt.h:1213
child_range children()
Definition: Stmt.h:1485
This class handles loading and caching of source files into memory.
BreakStmt(SourceLocation BL)
Definition: Stmt.h:1412
CompoundStmt * getTryBlock() const
Definition: Stmt.h:2022
Stmt * getSubStmt()
Definition: Stmt.h:943
CompoundStmt * getBlock() const
Definition: Stmt.h:1949
void setKeywordLoc(SourceLocation L)
Definition: Stmt.h:740
SourceLocation getReturnLoc() const
Definition: Stmt.h:1463
ReturnStmt(EmptyShell Empty)
Build an empty return expression.
Definition: Stmt.h:1457
bool capturesVariableArrayType() const
Determine whether this capture handles a variable-length array type.
Definition: Stmt.h:2127
Attr - This represents one attribute.
Definition: Attr.h:43
void setLabelLoc(SourceLocation L)
Definition: Stmt.h:1323
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.
child_iterator child_end()
Definition: Stmt.h:471
#define BLOCK(DERIVED, BASE)
Definition: Template.h:470
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1424
SourceLocation getEndLoc() const
Definition: Stmt.h:1980
const_capture_init_iterator capture_init_begin() const
Definition: Stmt.h:2255
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1474
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1326
SourceLocation getLocation() const
Retrieve the source location at which the variable or &#39;this&#39; was first used.
Definition: Stmt.h:2112
Stmt * getSubStmt()
Definition: Stmt.h:786
const DeclStmt * getConditionVariableDeclStmt() const
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
Definition: Stmt.h:1068
inputs_iterator end_inputs()
Definition: Stmt.h:1592
outputs_const_range outputs() const
Definition: Stmt.h:1637
const LabelDecl * getConstantTarget() const
Definition: Stmt.h:1366