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