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