clang  6.0.0svn
Stmt.h
Go to the documentation of this file.
1 //===- Stmt.h - Classes for representing statements -------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the Stmt interface and subclasses.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_AST_STMT_H
15 #define LLVM_CLANG_AST_STMT_H
16 
17 #include "clang/AST/DeclGroup.h"
18 #include "clang/AST/StmtIterator.h"
21 #include "clang/Basic/LLVM.h"
23 #include "llvm/ADT/ArrayRef.h"
24 #include "llvm/ADT/PointerIntPair.h"
25 #include "llvm/ADT/StringRef.h"
26 #include "llvm/ADT/iterator.h"
27 #include "llvm/ADT/iterator_range.h"
28 #include "llvm/Support/Casting.h"
29 #include "llvm/Support/Compiler.h"
30 #include "llvm/Support/ErrorHandling.h"
31 #include <algorithm>
32 #include <cassert>
33 #include <cstddef>
34 #include <iterator>
35 #include <string>
36 
37 namespace llvm {
38 
39 class FoldingSetNodeID;
40 
41 } // namespace llvm
42 
43 namespace clang {
44 
45 class ASTContext;
46 class Attr;
47 class CapturedDecl;
48 class Decl;
49 class Expr;
50 class LabelDecl;
51 class ODRHash;
52 class PrinterHelper;
53 struct PrintingPolicy;
54 class RecordDecl;
55 class SourceManager;
56 class StringLiteral;
57 class Token;
58 class VarDecl;
59 
60 //===----------------------------------------------------------------------===//
61 // AST classes for statements.
62 //===----------------------------------------------------------------------===//
63 
64 /// Stmt - This represents one statement.
65 ///
66 class alignas(void *) Stmt {
67 public:
68  enum StmtClass {
69  NoStmtClass = 0,
70 #define STMT(CLASS, PARENT) CLASS##Class,
71 #define STMT_RANGE(BASE, FIRST, LAST) \
72  first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class,
73 #define LAST_STMT_RANGE(BASE, FIRST, LAST) \
74  first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class
75 #define ABSTRACT_STMT(STMT)
76 #include "clang/AST/StmtNodes.inc"
77  };
78 
79  // Make vanilla 'new' and 'delete' illegal for Stmts.
80 protected:
81  friend class ASTStmtReader;
82  friend class ASTStmtWriter;
83 
84  void *operator new(size_t bytes) noexcept {
85  llvm_unreachable("Stmts cannot be allocated with regular 'new'.");
86  }
87 
88  void operator delete(void *data) noexcept {
89  llvm_unreachable("Stmts cannot be released with regular 'delete'.");
90  }
91 
92  class StmtBitfields {
93  friend class Stmt;
94 
95  /// \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 : public Stmt {
596  friend class ASTStmtReader;
597 
598  Stmt** Body = nullptr;
599  SourceLocation LBraceLoc, RBraceLoc;
600 
601 public:
604 
605  // \brief Build an empty compound statement with a location.
607  : Stmt(CompoundStmtClass), LBraceLoc(Loc), RBraceLoc(Loc) {
608  CompoundStmtBits.NumStmts = 0;
609  }
610 
611  // \brief Build an empty compound statement.
612  explicit CompoundStmt(EmptyShell Empty) : Stmt(CompoundStmtClass, Empty) {
613  CompoundStmtBits.NumStmts = 0;
614  }
615 
616  void setStmts(const ASTContext &C, ArrayRef<Stmt *> Stmts);
617 
618  bool body_empty() const { return CompoundStmtBits.NumStmts == 0; }
619  unsigned size() const { return CompoundStmtBits.NumStmts; }
620 
621  using body_iterator = Stmt **;
622  using body_range = llvm::iterator_range<body_iterator>;
623 
624  body_range body() { return body_range(body_begin(), body_end()); }
625  body_iterator body_begin() { return Body; }
626  body_iterator body_end() { return Body + size(); }
627  Stmt *body_front() { return !body_empty() ? Body[0] : nullptr; }
628  Stmt *body_back() { return !body_empty() ? Body[size()-1] : nullptr; }
629 
630  void setLastStmt(Stmt *S) {
631  assert(!body_empty() && "setLastStmt");
632  Body[size()-1] = S;
633  }
634 
635  using const_body_iterator = Stmt* const *;
636  using body_const_range = llvm::iterator_range<const_body_iterator>;
637 
639  return body_const_range(body_begin(), body_end());
640  }
641 
642  const_body_iterator body_begin() const { return Body; }
643  const_body_iterator body_end() const { return Body + size(); }
644 
645  const Stmt *body_front() const {
646  return !body_empty() ? Body[0] : nullptr;
647  }
648 
649  const Stmt *body_back() const {
650  return !body_empty() ? Body[size() - 1] : nullptr;
651  }
652 
653  using reverse_body_iterator = std::reverse_iterator<body_iterator>;
654 
656  return reverse_body_iterator(body_end());
657  }
658 
660  return reverse_body_iterator(body_begin());
661  }
662 
664  std::reverse_iterator<const_body_iterator>;
665 
667  return const_reverse_body_iterator(body_end());
668  }
669 
671  return const_reverse_body_iterator(body_begin());
672  }
673 
674  SourceLocation getLocStart() const LLVM_READONLY { return LBraceLoc; }
675  SourceLocation getLocEnd() const LLVM_READONLY { return RBraceLoc; }
676 
677  SourceLocation getLBracLoc() const { return LBraceLoc; }
678  SourceLocation getRBracLoc() const { return RBraceLoc; }
679 
680  static bool classof(const Stmt *T) {
681  return T->getStmtClass() == CompoundStmtClass;
682  }
683 
684  // Iterators
686  return child_range(Body, Body + CompoundStmtBits.NumStmts);
687  }
688 
690  return const_child_range(child_iterator(Body),
691  child_iterator(Body + CompoundStmtBits.NumStmts));
692  }
693 };
694 
695 // SwitchCase is the base class for CaseStmt and DefaultStmt,
696 class SwitchCase : public Stmt {
697 protected:
698  // A pointer to the following CaseStmt or DefaultStmt class,
699  // used by SwitchStmt.
700  SwitchCase *NextSwitchCase = nullptr;
703 
705  : Stmt(SC), KeywordLoc(KWLoc), ColonLoc(ColonLoc) {}
706 
708 
709 public:
710  const SwitchCase *getNextSwitchCase() const { return NextSwitchCase; }
711 
712  SwitchCase *getNextSwitchCase() { return NextSwitchCase; }
713 
714  void setNextSwitchCase(SwitchCase *SC) { NextSwitchCase = SC; }
715 
716  SourceLocation getKeywordLoc() const { return KeywordLoc; }
717  void setKeywordLoc(SourceLocation L) { KeywordLoc = L; }
718  SourceLocation getColonLoc() const { return ColonLoc; }
719  void setColonLoc(SourceLocation L) { ColonLoc = L; }
720 
721  Stmt *getSubStmt();
722  const Stmt *getSubStmt() const {
723  return const_cast<SwitchCase*>(this)->getSubStmt();
724  }
725 
726  SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; }
727  SourceLocation getLocEnd() const LLVM_READONLY;
728 
729  static bool classof(const Stmt *T) {
730  return T->getStmtClass() == CaseStmtClass ||
731  T->getStmtClass() == DefaultStmtClass;
732  }
733 };
734 
735 class CaseStmt : public SwitchCase {
736  SourceLocation EllipsisLoc;
737  enum { LHS, RHS, SUBSTMT, END_EXPR };
738  Stmt* SubExprs[END_EXPR]; // The expression for the RHS is Non-null for
739  // GNU "case 1 ... 4" extension
740 
741 public:
742  CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc,
743  SourceLocation ellipsisLoc, SourceLocation colonLoc)
744  : SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
745  SubExprs[SUBSTMT] = nullptr;
746  SubExprs[LHS] = reinterpret_cast<Stmt*>(lhs);
747  SubExprs[RHS] = reinterpret_cast<Stmt*>(rhs);
748  EllipsisLoc = ellipsisLoc;
749  }
750 
751  /// \brief Build an empty switch case statement.
752  explicit CaseStmt(EmptyShell Empty) : SwitchCase(CaseStmtClass, Empty) {}
753 
754  SourceLocation getCaseLoc() const { return KeywordLoc; }
755  void setCaseLoc(SourceLocation L) { KeywordLoc = L; }
756  SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
757  void setEllipsisLoc(SourceLocation L) { EllipsisLoc = L; }
758  SourceLocation getColonLoc() const { return ColonLoc; }
760 
761  Expr *getLHS() { return reinterpret_cast<Expr*>(SubExprs[LHS]); }
762  Expr *getRHS() { return reinterpret_cast<Expr*>(SubExprs[RHS]); }
763  Stmt *getSubStmt() { return SubExprs[SUBSTMT]; }
764 
765  const Expr *getLHS() const {
766  return reinterpret_cast<const Expr*>(SubExprs[LHS]);
767  }
768 
769  const Expr *getRHS() const {
770  return reinterpret_cast<const Expr*>(SubExprs[RHS]);
771  }
772 
773  const Stmt *getSubStmt() const { return SubExprs[SUBSTMT]; }
774 
775  void setSubStmt(Stmt *S) { SubExprs[SUBSTMT] = S; }
776  void setLHS(Expr *Val) { SubExprs[LHS] = reinterpret_cast<Stmt*>(Val); }
777  void setRHS(Expr *Val) { SubExprs[RHS] = reinterpret_cast<Stmt*>(Val); }
778 
779  SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; }
780 
781  SourceLocation getLocEnd() const LLVM_READONLY {
782  // Handle deeply nested case statements with iteration instead of recursion.
783  const CaseStmt *CS = this;
784  while (const CaseStmt *CS2 = dyn_cast<CaseStmt>(CS->getSubStmt()))
785  CS = CS2;
786 
787  return CS->getSubStmt()->getLocEnd();
788  }
789 
790  static bool classof(const Stmt *T) {
791  return T->getStmtClass() == CaseStmtClass;
792  }
793 
794  // Iterators
796  return child_range(&SubExprs[0], &SubExprs[END_EXPR]);
797  }
798 };
799 
800 class DefaultStmt : public SwitchCase {
801  Stmt* SubStmt;
802 
803 public:
805  SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {}
806 
807  /// \brief Build an empty default statement.
808  explicit DefaultStmt(EmptyShell Empty)
809  : SwitchCase(DefaultStmtClass, Empty) {}
810 
811  Stmt *getSubStmt() { return SubStmt; }
812  const Stmt *getSubStmt() const { return SubStmt; }
813  void setSubStmt(Stmt *S) { SubStmt = S; }
814 
815  SourceLocation getDefaultLoc() const { return KeywordLoc; }
816  void setDefaultLoc(SourceLocation L) { KeywordLoc = L; }
817  SourceLocation getColonLoc() const { return ColonLoc; }
819 
820  SourceLocation getLocStart() const LLVM_READONLY { return KeywordLoc; }
821  SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();}
822 
823  static bool classof(const Stmt *T) {
824  return T->getStmtClass() == DefaultStmtClass;
825  }
826 
827  // Iterators
828  child_range children() { return child_range(&SubStmt, &SubStmt+1); }
829 };
830 
831 inline SourceLocation SwitchCase::getLocEnd() const {
832  if (const CaseStmt *CS = dyn_cast<CaseStmt>(this))
833  return CS->getLocEnd();
834  return cast<DefaultStmt>(this)->getLocEnd();
835 }
836 
837 /// LabelStmt - Represents a label, which has a substatement. For example:
838 /// foo: return;
839 class LabelStmt : public Stmt {
840  SourceLocation IdentLoc;
841  LabelDecl *TheDecl;
842  Stmt *SubStmt;
843 
844 public:
846  : Stmt(LabelStmtClass), IdentLoc(IL), TheDecl(D), SubStmt(substmt) {
847  static_assert(sizeof(LabelStmt) ==
848  2 * sizeof(SourceLocation) + 2 * sizeof(void *),
849  "LabelStmt too big");
850  }
851 
852  // \brief Build an empty label statement.
853  explicit LabelStmt(EmptyShell Empty) : Stmt(LabelStmtClass, Empty) {}
854 
855  SourceLocation getIdentLoc() const { return IdentLoc; }
856  LabelDecl *getDecl() const { return TheDecl; }
857  void setDecl(LabelDecl *D) { TheDecl = D; }
858  const char *getName() const;
859  Stmt *getSubStmt() { return SubStmt; }
860  const Stmt *getSubStmt() const { return SubStmt; }
861  void setIdentLoc(SourceLocation L) { IdentLoc = L; }
862  void setSubStmt(Stmt *SS) { SubStmt = SS; }
863 
864  SourceLocation getLocStart() const LLVM_READONLY { return IdentLoc; }
865  SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();}
866 
867  child_range children() { return child_range(&SubStmt, &SubStmt+1); }
868 
869  static bool classof(const Stmt *T) {
870  return T->getStmtClass() == LabelStmtClass;
871  }
872 };
873 
874 /// \brief Represents an attribute applied to a statement.
875 ///
876 /// Represents an attribute applied to a statement. For example:
877 /// [[omp::for(...)]] for (...) { ... }
878 class AttributedStmt : public Stmt {
879  friend class ASTStmtReader;
880 
881  Stmt *SubStmt;
882  SourceLocation AttrLoc;
883  unsigned NumAttrs;
884 
886  : Stmt(AttributedStmtClass), SubStmt(SubStmt), AttrLoc(Loc),
887  NumAttrs(Attrs.size()) {
888  std::copy(Attrs.begin(), Attrs.end(), getAttrArrayPtr());
889  }
890 
891  explicit AttributedStmt(EmptyShell Empty, unsigned NumAttrs)
892  : Stmt(AttributedStmtClass, Empty), NumAttrs(NumAttrs) {
893  std::fill_n(getAttrArrayPtr(), NumAttrs, nullptr);
894  }
895 
896  const Attr *const *getAttrArrayPtr() const {
897  return reinterpret_cast<const Attr *const *>(this + 1);
898  }
899  const Attr **getAttrArrayPtr() {
900  return reinterpret_cast<const Attr **>(this + 1);
901  }
902 
903 public:
904  static AttributedStmt *Create(const ASTContext &C, SourceLocation Loc,
905  ArrayRef<const Attr*> Attrs, Stmt *SubStmt);
906 
907  // \brief Build an empty attributed statement.
908  static AttributedStmt *CreateEmpty(const ASTContext &C, unsigned NumAttrs);
909 
910  SourceLocation getAttrLoc() const { return AttrLoc; }
912  return llvm::makeArrayRef(getAttrArrayPtr(), NumAttrs);
913  }
914 
915  Stmt *getSubStmt() { return SubStmt; }
916  const Stmt *getSubStmt() const { return SubStmt; }
917 
918  SourceLocation getLocStart() const LLVM_READONLY { return AttrLoc; }
919  SourceLocation getLocEnd() const LLVM_READONLY { return SubStmt->getLocEnd();}
920 
921  child_range children() { return child_range(&SubStmt, &SubStmt + 1); }
922 
923  static bool classof(const Stmt *T) {
924  return T->getStmtClass() == AttributedStmtClass;
925  }
926 };
927 
928 /// IfStmt - This represents an if/then/else.
929 class IfStmt : public Stmt {
930  enum { INIT, VAR, COND, THEN, ELSE, END_EXPR };
931  Stmt* SubExprs[END_EXPR];
932 
933  SourceLocation IfLoc;
934  SourceLocation ElseLoc;
935 
936 public:
937  IfStmt(const ASTContext &C, SourceLocation IL,
938  bool IsConstexpr, Stmt *init, VarDecl *var, Expr *cond,
939  Stmt *then, SourceLocation EL = SourceLocation(),
940  Stmt *elsev = nullptr);
941 
942  /// \brief Build an empty if/then/else statement
943  explicit IfStmt(EmptyShell Empty) : Stmt(IfStmtClass, Empty) {}
944 
945  /// \brief Retrieve the variable declared in this "if" statement, if any.
946  ///
947  /// In the following example, "x" is the condition variable.
948  /// \code
949  /// if (int x = foo()) {
950  /// printf("x is %d", x);
951  /// }
952  /// \endcode
953  VarDecl *getConditionVariable() const;
954  void setConditionVariable(const ASTContext &C, VarDecl *V);
955 
956  /// If this IfStmt has a condition variable, return the faux DeclStmt
957  /// associated with the creation of that condition variable.
959  return reinterpret_cast<DeclStmt*>(SubExprs[VAR]);
960  }
961 
962  Stmt *getInit() { return SubExprs[INIT]; }
963  const Stmt *getInit() const { return SubExprs[INIT]; }
964  void setInit(Stmt *S) { SubExprs[INIT] = S; }
965  const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
966  void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt *>(E); }
967  const Stmt *getThen() const { return SubExprs[THEN]; }
968  void setThen(Stmt *S) { SubExprs[THEN] = S; }
969  const Stmt *getElse() const { return SubExprs[ELSE]; }
970  void setElse(Stmt *S) { SubExprs[ELSE] = S; }
971 
972  Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
973  Stmt *getThen() { return SubExprs[THEN]; }
974  Stmt *getElse() { return SubExprs[ELSE]; }
975 
976  SourceLocation getIfLoc() const { return IfLoc; }
977  void setIfLoc(SourceLocation L) { IfLoc = L; }
978  SourceLocation getElseLoc() const { return ElseLoc; }
979  void setElseLoc(SourceLocation L) { ElseLoc = L; }
980 
981  bool isConstexpr() const { return IfStmtBits.IsConstexpr; }
982  void setConstexpr(bool C) { IfStmtBits.IsConstexpr = C; }
983 
984  bool isObjCAvailabilityCheck() const;
985 
986  SourceLocation getLocStart() const LLVM_READONLY { return IfLoc; }
987 
988  SourceLocation getLocEnd() const LLVM_READONLY {
989  if (SubExprs[ELSE])
990  return SubExprs[ELSE]->getLocEnd();
991  else
992  return SubExprs[THEN]->getLocEnd();
993  }
994 
995  // Iterators over subexpressions. The iterators will include iterating
996  // over the initialization expression referenced by the condition variable.
998  return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
999  }
1000 
1001  static bool classof(const Stmt *T) {
1002  return T->getStmtClass() == IfStmtClass;
1003  }
1004 };
1005 
1006 /// SwitchStmt - This represents a 'switch' stmt.
1007 class SwitchStmt : public Stmt {
1008  SourceLocation SwitchLoc;
1009  enum { INIT, VAR, COND, BODY, END_EXPR };
1010  Stmt* SubExprs[END_EXPR];
1011 
1012  // This points to a linked list of case and default statements and, if the
1013  // SwitchStmt is a switch on an enum value, records whether all the enum
1014  // values were covered by CaseStmts. The coverage information value is meant
1015  // to be a hint for possible clients.
1016  llvm::PointerIntPair<SwitchCase *, 1, bool> FirstCase;
1017 
1018 public:
1019  SwitchStmt(const ASTContext &C, Stmt *Init, VarDecl *Var, Expr *cond);
1020 
1021  /// \brief Build a empty switch statement.
1022  explicit SwitchStmt(EmptyShell Empty) : Stmt(SwitchStmtClass, Empty) {}
1023 
1024  /// \brief Retrieve the variable declared in this "switch" statement, if any.
1025  ///
1026  /// In the following example, "x" is the condition variable.
1027  /// \code
1028  /// switch (int x = foo()) {
1029  /// case 0: break;
1030  /// // ...
1031  /// }
1032  /// \endcode
1033  VarDecl *getConditionVariable() const;
1034  void setConditionVariable(const ASTContext &C, VarDecl *V);
1035 
1036  /// If this SwitchStmt has a condition variable, return the faux DeclStmt
1037  /// associated with the creation of that condition variable.
1039  return reinterpret_cast<DeclStmt*>(SubExprs[VAR]);
1040  }
1041 
1042  Stmt *getInit() { return SubExprs[INIT]; }
1043  const Stmt *getInit() const { return SubExprs[INIT]; }
1044  void setInit(Stmt *S) { SubExprs[INIT] = S; }
1045  const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
1046  const Stmt *getBody() const { return SubExprs[BODY]; }
1047  const SwitchCase *getSwitchCaseList() const { return FirstCase.getPointer(); }
1048 
1049  Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]);}
1050  void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt *>(E); }
1051  Stmt *getBody() { return SubExprs[BODY]; }
1052  void setBody(Stmt *S) { SubExprs[BODY] = S; }
1053  SwitchCase *getSwitchCaseList() { return FirstCase.getPointer(); }
1054 
1055  /// \brief Set the case list for this switch statement.
1056  void setSwitchCaseList(SwitchCase *SC) { FirstCase.setPointer(SC); }
1057 
1058  SourceLocation getSwitchLoc() const { return SwitchLoc; }
1059  void setSwitchLoc(SourceLocation L) { SwitchLoc = L; }
1060 
1061  void setBody(Stmt *S, SourceLocation SL) {
1062  SubExprs[BODY] = S;
1063  SwitchLoc = SL;
1064  }
1065 
1067  assert(!SC->getNextSwitchCase()
1068  && "case/default already added to a switch");
1069  SC->setNextSwitchCase(FirstCase.getPointer());
1070  FirstCase.setPointer(SC);
1071  }
1072 
1073  /// Set a flag in the SwitchStmt indicating that if the 'switch (X)' is a
1074  /// switch over an enum value then all cases have been explicitly covered.
1075  void setAllEnumCasesCovered() { FirstCase.setInt(true); }
1076 
1077  /// Returns true if the SwitchStmt is a switch of an enum value and all cases
1078  /// have been explicitly covered.
1079  bool isAllEnumCasesCovered() const { return FirstCase.getInt(); }
1080 
1081  SourceLocation getLocStart() const LLVM_READONLY { return SwitchLoc; }
1082 
1083  SourceLocation getLocEnd() const LLVM_READONLY {
1084  return SubExprs[BODY] ? SubExprs[BODY]->getLocEnd() : SubExprs[COND]->getLocEnd();
1085  }
1086 
1087  // Iterators
1089  return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1090  }
1091 
1092  static bool classof(const Stmt *T) {
1093  return T->getStmtClass() == SwitchStmtClass;
1094  }
1095 };
1096 
1097 /// WhileStmt - This represents a 'while' stmt.
1098 class WhileStmt : public Stmt {
1099  SourceLocation WhileLoc;
1100  enum { VAR, COND, BODY, END_EXPR };
1101  Stmt* SubExprs[END_EXPR];
1102 
1103 public:
1104  WhileStmt(const ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body,
1105  SourceLocation WL);
1106 
1107  /// \brief Build an empty while statement.
1108  explicit WhileStmt(EmptyShell Empty) : Stmt(WhileStmtClass, Empty) {}
1109 
1110  /// \brief Retrieve the variable declared in this "while" statement, if any.
1111  ///
1112  /// In the following example, "x" is the condition variable.
1113  /// \code
1114  /// while (int x = random()) {
1115  /// // ...
1116  /// }
1117  /// \endcode
1118  VarDecl *getConditionVariable() const;
1119  void setConditionVariable(const ASTContext &C, VarDecl *V);
1120 
1121  /// If this WhileStmt has a condition variable, return the faux DeclStmt
1122  /// associated with the creation of that condition variable.
1124  return reinterpret_cast<DeclStmt*>(SubExprs[VAR]);
1125  }
1126 
1127  Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
1128  const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
1129  void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt*>(E); }
1130  Stmt *getBody() { return SubExprs[BODY]; }
1131  const Stmt *getBody() const { return SubExprs[BODY]; }
1132  void setBody(Stmt *S) { SubExprs[BODY] = S; }
1133 
1134  SourceLocation getWhileLoc() const { return WhileLoc; }
1135  void setWhileLoc(SourceLocation L) { WhileLoc = L; }
1136 
1137  SourceLocation getLocStart() const LLVM_READONLY { return WhileLoc; }
1138 
1139  SourceLocation getLocEnd() const LLVM_READONLY {
1140  return SubExprs[BODY]->getLocEnd();
1141  }
1142 
1143  static bool classof(const Stmt *T) {
1144  return T->getStmtClass() == WhileStmtClass;
1145  }
1146 
1147  // Iterators
1149  return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1150  }
1151 };
1152 
1153 /// DoStmt - This represents a 'do/while' stmt.
1154 class DoStmt : public Stmt {
1155  SourceLocation DoLoc;
1156  enum { BODY, COND, END_EXPR };
1157  Stmt* SubExprs[END_EXPR];
1158  SourceLocation WhileLoc;
1159  SourceLocation RParenLoc; // Location of final ')' in do stmt condition.
1160 
1161 public:
1163  SourceLocation RP)
1164  : Stmt(DoStmtClass), DoLoc(DL), WhileLoc(WL), RParenLoc(RP) {
1165  SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
1166  SubExprs[BODY] = body;
1167  }
1168 
1169  /// \brief Build an empty do-while statement.
1170  explicit DoStmt(EmptyShell Empty) : Stmt(DoStmtClass, Empty) {}
1171 
1172  Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
1173  const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
1174  void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt*>(E); }
1175  Stmt *getBody() { return SubExprs[BODY]; }
1176  const Stmt *getBody() const { return SubExprs[BODY]; }
1177  void setBody(Stmt *S) { SubExprs[BODY] = S; }
1178 
1179  SourceLocation getDoLoc() const { return DoLoc; }
1180  void setDoLoc(SourceLocation L) { DoLoc = L; }
1181  SourceLocation getWhileLoc() const { return WhileLoc; }
1182  void setWhileLoc(SourceLocation L) { WhileLoc = L; }
1183 
1184  SourceLocation getRParenLoc() const { return RParenLoc; }
1185  void setRParenLoc(SourceLocation L) { RParenLoc = L; }
1186 
1187  SourceLocation getLocStart() const LLVM_READONLY { return DoLoc; }
1188  SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
1189 
1190  static bool classof(const Stmt *T) {
1191  return T->getStmtClass() == DoStmtClass;
1192  }
1193 
1194  // Iterators
1196  return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1197  }
1198 };
1199 
1200 /// ForStmt - This represents a 'for (init;cond;inc)' stmt. Note that any of
1201 /// the init/cond/inc parts of the ForStmt will be null if they were not
1202 /// specified in the source.
1203 class ForStmt : public Stmt {
1204  SourceLocation ForLoc;
1205  enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
1206  Stmt* SubExprs[END_EXPR]; // SubExprs[INIT] is an expression or declstmt.
1207  SourceLocation LParenLoc, RParenLoc;
1208 
1209 public:
1210  ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar,
1211  Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP,
1212  SourceLocation RP);
1213 
1214  /// \brief Build an empty for statement.
1215  explicit ForStmt(EmptyShell Empty) : Stmt(ForStmtClass, Empty) {}
1216 
1217  Stmt *getInit() { return SubExprs[INIT]; }
1218 
1219  /// \brief Retrieve the variable declared in this "for" statement, if any.
1220  ///
1221  /// In the following example, "y" is the condition variable.
1222  /// \code
1223  /// for (int x = random(); int y = mangle(x); ++x) {
1224  /// // ...
1225  /// }
1226  /// \endcode
1227  VarDecl *getConditionVariable() const;
1228  void setConditionVariable(const ASTContext &C, VarDecl *V);
1229 
1230  /// If this ForStmt has a condition variable, return the faux DeclStmt
1231  /// associated with the creation of that condition variable.
1233  return reinterpret_cast<DeclStmt*>(SubExprs[CONDVAR]);
1234  }
1235 
1236  Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
1237  Expr *getInc() { return reinterpret_cast<Expr*>(SubExprs[INC]); }
1238  Stmt *getBody() { return SubExprs[BODY]; }
1239 
1240  const Stmt *getInit() const { return SubExprs[INIT]; }
1241  const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
1242  const Expr *getInc() const { return reinterpret_cast<Expr*>(SubExprs[INC]); }
1243  const Stmt *getBody() const { return SubExprs[BODY]; }
1244 
1245  void setInit(Stmt *S) { SubExprs[INIT] = S; }
1246  void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt*>(E); }
1247  void setInc(Expr *E) { SubExprs[INC] = reinterpret_cast<Stmt*>(E); }
1248  void setBody(Stmt *S) { SubExprs[BODY] = S; }
1249 
1250  SourceLocation getForLoc() const { return ForLoc; }
1251  void setForLoc(SourceLocation L) { ForLoc = L; }
1252  SourceLocation getLParenLoc() const { return LParenLoc; }
1253  void setLParenLoc(SourceLocation L) { LParenLoc = L; }
1254  SourceLocation getRParenLoc() const { return RParenLoc; }
1255  void setRParenLoc(SourceLocation L) { RParenLoc = L; }
1256 
1257  SourceLocation getLocStart() const LLVM_READONLY { return ForLoc; }
1258 
1259  SourceLocation getLocEnd() const LLVM_READONLY {
1260  return SubExprs[BODY]->getLocEnd();
1261  }
1262 
1263  static bool classof(const Stmt *T) {
1264  return T->getStmtClass() == ForStmtClass;
1265  }
1266 
1267  // Iterators
1269  return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
1270  }
1271 };
1272 
1273 /// GotoStmt - This represents a direct goto.
1274 class GotoStmt : public Stmt {
1275  LabelDecl *Label;
1276  SourceLocation GotoLoc;
1277  SourceLocation LabelLoc;
1278 
1279 public:
1281  : Stmt(GotoStmtClass), Label(label), GotoLoc(GL), LabelLoc(LL) {}
1282 
1283  /// \brief Build an empty goto statement.
1284  explicit GotoStmt(EmptyShell Empty) : Stmt(GotoStmtClass, Empty) {}
1285 
1286  LabelDecl *getLabel() const { return Label; }
1287  void setLabel(LabelDecl *D) { Label = D; }
1288 
1289  SourceLocation getGotoLoc() const { return GotoLoc; }
1290  void setGotoLoc(SourceLocation L) { GotoLoc = L; }
1291  SourceLocation getLabelLoc() const { return LabelLoc; }
1292  void setLabelLoc(SourceLocation L) { LabelLoc = L; }
1293 
1294  SourceLocation getLocStart() const LLVM_READONLY { return GotoLoc; }
1295  SourceLocation getLocEnd() const LLVM_READONLY { return LabelLoc; }
1296 
1297  static bool classof(const Stmt *T) {
1298  return T->getStmtClass() == GotoStmtClass;
1299  }
1300 
1301  // Iterators
1304  }
1305 };
1306 
1307 /// IndirectGotoStmt - This represents an indirect goto.
1308 class IndirectGotoStmt : public Stmt {
1309  SourceLocation GotoLoc;
1310  SourceLocation StarLoc;
1311  Stmt *Target;
1312 
1313 public:
1315  Expr *target)
1316  : Stmt(IndirectGotoStmtClass), GotoLoc(gotoLoc), StarLoc(starLoc),
1317  Target((Stmt*)target) {}
1318 
1319  /// \brief Build an empty indirect goto statement.
1321  : Stmt(IndirectGotoStmtClass, Empty) {}
1322 
1323  void setGotoLoc(SourceLocation L) { GotoLoc = L; }
1324  SourceLocation getGotoLoc() const { return GotoLoc; }
1325  void setStarLoc(SourceLocation L) { StarLoc = L; }
1326  SourceLocation getStarLoc() const { return StarLoc; }
1327 
1328  Expr *getTarget() { return reinterpret_cast<Expr*>(Target); }
1329  const Expr *getTarget() const {return reinterpret_cast<const Expr*>(Target);}
1330  void setTarget(Expr *E) { Target = reinterpret_cast<Stmt*>(E); }
1331 
1332  /// getConstantTarget - Returns the fixed target of this indirect
1333  /// goto, if one exists.
1334  LabelDecl *getConstantTarget();
1335  const LabelDecl *getConstantTarget() const {
1336  return const_cast<IndirectGotoStmt*>(this)->getConstantTarget();
1337  }
1338 
1339  SourceLocation getLocStart() const LLVM_READONLY { return GotoLoc; }
1340  SourceLocation getLocEnd() const LLVM_READONLY { return Target->getLocEnd(); }
1341 
1342  static bool classof(const Stmt *T) {
1343  return T->getStmtClass() == IndirectGotoStmtClass;
1344  }
1345 
1346  // Iterators
1347  child_range children() { return child_range(&Target, &Target+1); }
1348 };
1349 
1350 /// ContinueStmt - This represents a continue.
1351 class ContinueStmt : public Stmt {
1352  SourceLocation ContinueLoc;
1353 
1354 public:
1355  ContinueStmt(SourceLocation CL) : Stmt(ContinueStmtClass), ContinueLoc(CL) {}
1356 
1357  /// \brief Build an empty continue statement.
1358  explicit ContinueStmt(EmptyShell Empty) : Stmt(ContinueStmtClass, Empty) {}
1359 
1360  SourceLocation getContinueLoc() const { return ContinueLoc; }
1361  void setContinueLoc(SourceLocation L) { ContinueLoc = L; }
1362 
1363  SourceLocation getLocStart() const LLVM_READONLY { return ContinueLoc; }
1364  SourceLocation getLocEnd() const LLVM_READONLY { return ContinueLoc; }
1365 
1366  static bool classof(const Stmt *T) {
1367  return T->getStmtClass() == ContinueStmtClass;
1368  }
1369 
1370  // Iterators
1373  }
1374 };
1375 
1376 /// BreakStmt - This represents a break.
1377 class BreakStmt : public Stmt {
1378  SourceLocation BreakLoc;
1379 
1380 public:
1381  BreakStmt(SourceLocation BL) : Stmt(BreakStmtClass), BreakLoc(BL) {
1382  static_assert(sizeof(BreakStmt) == 2 * sizeof(SourceLocation),
1383  "BreakStmt too large");
1384  }
1385 
1386  /// \brief Build an empty break statement.
1387  explicit BreakStmt(EmptyShell Empty) : Stmt(BreakStmtClass, Empty) {}
1388 
1389  SourceLocation getBreakLoc() const { return BreakLoc; }
1390  void setBreakLoc(SourceLocation L) { BreakLoc = L; }
1391 
1392  SourceLocation getLocStart() const LLVM_READONLY { return BreakLoc; }
1393  SourceLocation getLocEnd() const LLVM_READONLY { return BreakLoc; }
1394 
1395  static bool classof(const Stmt *T) {
1396  return T->getStmtClass() == BreakStmtClass;
1397  }
1398 
1399  // Iterators
1402  }
1403 };
1404 
1405 /// ReturnStmt - This represents a return, optionally of an expression:
1406 /// return;
1407 /// return 4;
1408 ///
1409 /// Note that GCC allows return with no argument in a function declared to
1410 /// return a value, and it allows returning a value in functions declared to
1411 /// return void. We explicitly model this in the AST, which means you can't
1412 /// depend on the return type of the function and the presence of an argument.
1413 class ReturnStmt : public Stmt {
1414  SourceLocation RetLoc;
1415  Stmt *RetExpr;
1416  const VarDecl *NRVOCandidate;
1417 
1418 public:
1419  explicit ReturnStmt(SourceLocation RL) : ReturnStmt(RL, nullptr, nullptr) {}
1420 
1421  ReturnStmt(SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
1422  : Stmt(ReturnStmtClass), RetLoc(RL), RetExpr((Stmt *)E),
1423  NRVOCandidate(NRVOCandidate) {}
1424 
1425  /// \brief Build an empty return expression.
1426  explicit ReturnStmt(EmptyShell Empty) : Stmt(ReturnStmtClass, Empty) {}
1427 
1428  const Expr *getRetValue() const;
1429  Expr *getRetValue();
1430  void setRetValue(Expr *E) { RetExpr = reinterpret_cast<Stmt*>(E); }
1431 
1432  SourceLocation getReturnLoc() const { return RetLoc; }
1433  void setReturnLoc(SourceLocation L) { RetLoc = L; }
1434 
1435  /// \brief Retrieve the variable that might be used for the named return
1436  /// value optimization.
1437  ///
1438  /// The optimization itself can only be performed if the variable is
1439  /// also marked as an NRVO object.
1440  const VarDecl *getNRVOCandidate() const { return NRVOCandidate; }
1441  void setNRVOCandidate(const VarDecl *Var) { NRVOCandidate = Var; }
1442 
1443  SourceLocation getLocStart() const LLVM_READONLY { return RetLoc; }
1444 
1445  SourceLocation getLocEnd() const LLVM_READONLY {
1446  return RetExpr ? RetExpr->getLocEnd() : RetLoc;
1447  }
1448 
1449  static bool classof(const Stmt *T) {
1450  return T->getStmtClass() == ReturnStmtClass;
1451  }
1452 
1453  // Iterators
1455  if (RetExpr) return child_range(&RetExpr, &RetExpr+1);
1457  }
1458 };
1459 
1460 /// AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
1461 class AsmStmt : public Stmt {
1462 protected:
1463  friend class ASTStmtReader;
1464 
1466 
1467  /// \brief True if the assembly statement does not have any input or output
1468  /// operands.
1469  bool IsSimple;
1470 
1471  /// \brief If true, treat this inline assembly as having side effects.
1472  /// This assembly statement should not be optimized, deleted or moved.
1474 
1475  unsigned NumOutputs;
1476  unsigned NumInputs;
1477  unsigned NumClobbers;
1478 
1479  Stmt **Exprs = nullptr;
1480 
1481  AsmStmt(StmtClass SC, SourceLocation asmloc, bool issimple, bool isvolatile,
1482  unsigned numoutputs, unsigned numinputs, unsigned numclobbers)
1483  : Stmt (SC), AsmLoc(asmloc), IsSimple(issimple), IsVolatile(isvolatile),
1484  NumOutputs(numoutputs), NumInputs(numinputs),
1485  NumClobbers(numclobbers) {}
1486 
1487 public:
1488  /// \brief Build an empty inline-assembly statement.
1489  explicit AsmStmt(StmtClass SC, EmptyShell Empty) : Stmt(SC, Empty) {}
1490 
1491  SourceLocation getAsmLoc() const { return AsmLoc; }
1492  void setAsmLoc(SourceLocation L) { AsmLoc = L; }
1493 
1494  bool isSimple() const { return IsSimple; }
1495  void setSimple(bool V) { IsSimple = V; }
1496 
1497  bool isVolatile() const { return IsVolatile; }
1498  void setVolatile(bool V) { IsVolatile = V; }
1499 
1500  SourceLocation getLocStart() const LLVM_READONLY { return SourceLocation(); }
1501  SourceLocation getLocEnd() const LLVM_READONLY { return SourceLocation(); }
1502 
1503  //===--- Asm String Analysis ---===//
1504 
1505  /// Assemble final IR asm string.
1506  std::string generateAsmString(const ASTContext &C) const;
1507 
1508  //===--- Output operands ---===//
1509 
1510  unsigned getNumOutputs() const { return NumOutputs; }
1511 
1512  /// getOutputConstraint - Return the constraint string for the specified
1513  /// output operand. All output constraints are known to be non-empty (either
1514  /// '=' or '+').
1515  StringRef getOutputConstraint(unsigned i) const;
1516 
1517  /// isOutputPlusConstraint - Return true if the specified output constraint
1518  /// is a "+" constraint (which is both an input and an output) or false if it
1519  /// is an "=" constraint (just an output).
1520  bool isOutputPlusConstraint(unsigned i) const {
1521  return getOutputConstraint(i)[0] == '+';
1522  }
1523 
1524  const Expr *getOutputExpr(unsigned i) const;
1525 
1526  /// getNumPlusOperands - Return the number of output operands that have a "+"
1527  /// constraint.
1528  unsigned getNumPlusOperands() const;
1529 
1530  //===--- Input operands ---===//
1531 
1532  unsigned getNumInputs() const { return NumInputs; }
1533 
1534  /// getInputConstraint - Return the specified input constraint. Unlike output
1535  /// constraints, these can be empty.
1536  StringRef getInputConstraint(unsigned i) const;
1537 
1538  const Expr *getInputExpr(unsigned i) const;
1539 
1540  //===--- Other ---===//
1541 
1542  unsigned getNumClobbers() const { return NumClobbers; }
1543  StringRef getClobber(unsigned i) const;
1544 
1545  static bool classof(const Stmt *T) {
1546  return T->getStmtClass() == GCCAsmStmtClass ||
1547  T->getStmtClass() == MSAsmStmtClass;
1548  }
1549 
1550  // Input expr iterators.
1551 
1554  using inputs_range = llvm::iterator_range<inputs_iterator>;
1555  using inputs_const_range = llvm::iterator_range<const_inputs_iterator>;
1556 
1558  return &Exprs[0] + NumOutputs;
1559  }
1560 
1562  return &Exprs[0] + NumOutputs + NumInputs;
1563  }
1564 
1565  inputs_range inputs() { return inputs_range(begin_inputs(), end_inputs()); }
1566 
1568  return &Exprs[0] + NumOutputs;
1569  }
1570 
1572  return &Exprs[0] + NumOutputs + NumInputs;
1573  }
1574 
1576  return inputs_const_range(begin_inputs(), end_inputs());
1577  }
1578 
1579  // Output expr iterators.
1580 
1583  using outputs_range = llvm::iterator_range<outputs_iterator>;
1584  using outputs_const_range = llvm::iterator_range<const_outputs_iterator>;
1585 
1587  return &Exprs[0];
1588  }
1589 
1591  return &Exprs[0] + NumOutputs;
1592  }
1593 
1595  return outputs_range(begin_outputs(), end_outputs());
1596  }
1597 
1599  return &Exprs[0];
1600  }
1601 
1603  return &Exprs[0] + NumOutputs;
1604  }
1605 
1607  return outputs_const_range(begin_outputs(), end_outputs());
1608  }
1609 
1611  return child_range(&Exprs[0], &Exprs[0] + NumOutputs + NumInputs);
1612  }
1613 };
1614 
1615 /// This represents a GCC inline-assembly statement extension.
1616 class GCCAsmStmt : public AsmStmt {
1617  friend class ASTStmtReader;
1618 
1619  SourceLocation RParenLoc;
1620  StringLiteral *AsmStr;
1621 
1622  // FIXME: If we wanted to, we could allocate all of these in one big array.
1623  StringLiteral **Constraints = nullptr;
1624  StringLiteral **Clobbers = nullptr;
1625  IdentifierInfo **Names = nullptr;
1626 
1627 public:
1628  GCCAsmStmt(const ASTContext &C, SourceLocation asmloc, bool issimple,
1629  bool isvolatile, unsigned numoutputs, unsigned numinputs,
1630  IdentifierInfo **names, StringLiteral **constraints, Expr **exprs,
1631  StringLiteral *asmstr, unsigned numclobbers,
1632  StringLiteral **clobbers, SourceLocation rparenloc);
1633 
1634  /// \brief Build an empty inline-assembly statement.
1635  explicit GCCAsmStmt(EmptyShell Empty) : AsmStmt(GCCAsmStmtClass, Empty) {}
1636 
1637  SourceLocation getRParenLoc() const { return RParenLoc; }
1638  void setRParenLoc(SourceLocation L) { RParenLoc = L; }
1639 
1640  //===--- Asm String Analysis ---===//
1641 
1642  const StringLiteral *getAsmString() const { return AsmStr; }
1643  StringLiteral *getAsmString() { return AsmStr; }
1644  void setAsmString(StringLiteral *E) { AsmStr = E; }
1645 
1646  /// AsmStringPiece - this is part of a decomposed asm string specification
1647  /// (for use with the AnalyzeAsmString function below). An asm string is
1648  /// considered to be a concatenation of these parts.
1650  public:
1651  enum Kind {
1652  String, // String in .ll asm string form, "$" -> "$$" and "%%" -> "%".
1653  Operand // Operand reference, with optional modifier %c4.
1654  };
1655 
1656  private:
1657  Kind MyKind;
1658  std::string Str;
1659  unsigned OperandNo;
1660 
1661  // Source range for operand references.
1662  CharSourceRange Range;
1663 
1664  public:
1665  AsmStringPiece(const std::string &S) : MyKind(String), Str(S) {}
1666  AsmStringPiece(unsigned OpNo, const std::string &S, SourceLocation Begin,
1668  : MyKind(Operand), Str(S), OperandNo(OpNo),
1669  Range(CharSourceRange::getCharRange(Begin, End)) {}
1670 
1671  bool isString() const { return MyKind == String; }
1672  bool isOperand() const { return MyKind == Operand; }
1673 
1674  const std::string &getString() const {
1675  return Str;
1676  }
1677 
1678  unsigned getOperandNo() const {
1679  assert(isOperand());
1680  return OperandNo;
1681  }
1682 
1684  assert(isOperand() && "Range is currently used only for Operands.");
1685  return Range;
1686  }
1687 
1688  /// getModifier - Get the modifier for this operand, if present. This
1689  /// returns '\0' if there was no modifier.
1690  char getModifier() const;
1691  };
1692 
1693  /// AnalyzeAsmString - Analyze the asm string of the current asm, decomposing
1694  /// it into pieces. If the asm string is erroneous, emit errors and return
1695  /// true, otherwise return false. This handles canonicalization and
1696  /// translation of strings from GCC syntax to LLVM IR syntax, and handles
1697  //// flattening of named references like %[foo] to Operand AsmStringPiece's.
1698  unsigned AnalyzeAsmString(SmallVectorImpl<AsmStringPiece> &Pieces,
1699  const ASTContext &C, unsigned &DiagOffs) const;
1700 
1701  /// Assemble final IR asm string.
1702  std::string generateAsmString(const ASTContext &C) const;
1703 
1704  //===--- Output operands ---===//
1705 
1707  return Names[i];
1708  }
1709 
1710  StringRef getOutputName(unsigned i) const {
1711  if (IdentifierInfo *II = getOutputIdentifier(i))
1712  return II->getName();
1713 
1714  return StringRef();
1715  }
1716 
1717  StringRef getOutputConstraint(unsigned i) const;
1718 
1719  const StringLiteral *getOutputConstraintLiteral(unsigned i) const {
1720  return Constraints[i];
1721  }
1723  return Constraints[i];
1724  }
1725 
1726  Expr *getOutputExpr(unsigned i);
1727 
1728  const Expr *getOutputExpr(unsigned i) const {
1729  return const_cast<GCCAsmStmt*>(this)->getOutputExpr(i);
1730  }
1731 
1732  //===--- Input operands ---===//
1733 
1734  IdentifierInfo *getInputIdentifier(unsigned i) const {
1735  return Names[i + NumOutputs];
1736  }
1737 
1738  StringRef getInputName(unsigned i) const {
1739  if (IdentifierInfo *II = getInputIdentifier(i))
1740  return II->getName();
1741 
1742  return StringRef();
1743  }
1744 
1745  StringRef getInputConstraint(unsigned i) const;
1746 
1747  const StringLiteral *getInputConstraintLiteral(unsigned i) const {
1748  return Constraints[i + NumOutputs];
1749  }
1751  return Constraints[i + NumOutputs];
1752  }
1753 
1754  Expr *getInputExpr(unsigned i);
1755  void setInputExpr(unsigned i, Expr *E);
1756 
1757  const Expr *getInputExpr(unsigned i) const {
1758  return const_cast<GCCAsmStmt*>(this)->getInputExpr(i);
1759  }
1760 
1761 private:
1762  void setOutputsAndInputsAndClobbers(const ASTContext &C,
1763  IdentifierInfo **Names,
1764  StringLiteral **Constraints,
1765  Stmt **Exprs,
1766  unsigned NumOutputs,
1767  unsigned NumInputs,
1768  StringLiteral **Clobbers,
1769  unsigned NumClobbers);
1770 
1771 public:
1772  //===--- Other ---===//
1773 
1774  /// getNamedOperand - Given a symbolic operand reference like %[foo],
1775  /// translate this into a numeric value needed to reference the same operand.
1776  /// This returns -1 if the operand name is invalid.
1777  int getNamedOperand(StringRef SymbolicName) const;
1778 
1779  StringRef getClobber(unsigned i) const;
1780 
1781  StringLiteral *getClobberStringLiteral(unsigned i) { return Clobbers[i]; }
1782  const StringLiteral *getClobberStringLiteral(unsigned i) const {
1783  return Clobbers[i];
1784  }
1785 
1786  SourceLocation getLocStart() const LLVM_READONLY { return AsmLoc; }
1787  SourceLocation getLocEnd() const LLVM_READONLY { return RParenLoc; }
1788 
1789  static bool classof(const Stmt *T) {
1790  return T->getStmtClass() == GCCAsmStmtClass;
1791  }
1792 };
1793 
1794 /// This represents a Microsoft inline-assembly statement extension.
1795 class MSAsmStmt : public AsmStmt {
1796  friend class ASTStmtReader;
1797 
1798  SourceLocation LBraceLoc, EndLoc;
1799  StringRef AsmStr;
1800 
1801  unsigned NumAsmToks = 0;
1802 
1803  Token *AsmToks = nullptr;
1804  StringRef *Constraints = nullptr;
1805  StringRef *Clobbers = nullptr;
1806 
1807 public:
1808  MSAsmStmt(const ASTContext &C, SourceLocation asmloc,
1809  SourceLocation lbraceloc, bool issimple, bool isvolatile,
1810  ArrayRef<Token> asmtoks, unsigned numoutputs, unsigned numinputs,
1811  ArrayRef<StringRef> constraints,
1812  ArrayRef<Expr*> exprs, StringRef asmstr,
1813  ArrayRef<StringRef> clobbers, SourceLocation endloc);
1814 
1815  /// \brief Build an empty MS-style inline-assembly statement.
1816  explicit MSAsmStmt(EmptyShell Empty) : AsmStmt(MSAsmStmtClass, Empty) {}
1817 
1818  SourceLocation getLBraceLoc() const { return LBraceLoc; }
1819  void setLBraceLoc(SourceLocation L) { LBraceLoc = L; }
1820  SourceLocation getEndLoc() const { return EndLoc; }
1821  void setEndLoc(SourceLocation L) { EndLoc = L; }
1822 
1823  bool hasBraces() const { return LBraceLoc.isValid(); }
1824 
1825  unsigned getNumAsmToks() { return NumAsmToks; }
1826  Token *getAsmToks() { return AsmToks; }
1827 
1828  //===--- Asm String Analysis ---===//
1829  StringRef getAsmString() const { return AsmStr; }
1830 
1831  /// Assemble final IR asm string.
1832  std::string generateAsmString(const ASTContext &C) const;
1833 
1834  //===--- Output operands ---===//
1835 
1836  StringRef getOutputConstraint(unsigned i) const {
1837  assert(i < NumOutputs);
1838  return Constraints[i];
1839  }
1840 
1841  Expr *getOutputExpr(unsigned i);
1842 
1843  const Expr *getOutputExpr(unsigned i) const {
1844  return const_cast<MSAsmStmt*>(this)->getOutputExpr(i);
1845  }
1846 
1847  //===--- Input operands ---===//
1848 
1849  StringRef getInputConstraint(unsigned i) const {
1850  assert(i < NumInputs);
1851  return Constraints[i + NumOutputs];
1852  }
1853 
1854  Expr *getInputExpr(unsigned i);
1855  void setInputExpr(unsigned i, Expr *E);
1856 
1857  const Expr *getInputExpr(unsigned i) const {
1858  return const_cast<MSAsmStmt*>(this)->getInputExpr(i);
1859  }
1860 
1861  //===--- Other ---===//
1862 
1864  return llvm::makeArrayRef(Constraints, NumInputs + NumOutputs);
1865  }
1866 
1868  return llvm::makeArrayRef(Clobbers, NumClobbers);
1869  }
1870 
1872  return llvm::makeArrayRef(reinterpret_cast<Expr**>(Exprs),
1873  NumInputs + NumOutputs);
1874  }
1875 
1876  StringRef getClobber(unsigned i) const { return getClobbers()[i]; }
1877 
1878 private:
1879  void initialize(const ASTContext &C, StringRef AsmString,
1880  ArrayRef<Token> AsmToks, ArrayRef<StringRef> Constraints,
1881  ArrayRef<Expr*> Exprs, ArrayRef<StringRef> Clobbers);
1882 
1883 public:
1884  SourceLocation getLocStart() const LLVM_READONLY { return AsmLoc; }
1885  SourceLocation getLocEnd() const LLVM_READONLY { return EndLoc; }
1886 
1887  static bool classof(const Stmt *T) {
1888  return T->getStmtClass() == MSAsmStmtClass;
1889  }
1890 
1892  return child_range(&Exprs[0], &Exprs[NumInputs + NumOutputs]);
1893  }
1894 };
1895 
1896 class SEHExceptStmt : public Stmt {
1897  friend class ASTReader;
1898  friend class ASTStmtReader;
1899 
1900  SourceLocation Loc;
1901  Stmt *Children[2];
1902 
1903  enum { FILTER_EXPR, BLOCK };
1904 
1905  SEHExceptStmt(SourceLocation Loc, Expr *FilterExpr, Stmt *Block);
1906  explicit SEHExceptStmt(EmptyShell E) : Stmt(SEHExceptStmtClass, E) {}
1907 
1908 public:
1909  static SEHExceptStmt* Create(const ASTContext &C,
1910  SourceLocation ExceptLoc,
1911  Expr *FilterExpr,
1912  Stmt *Block);
1913 
1914  SourceLocation getLocStart() const LLVM_READONLY { return getExceptLoc(); }
1915  SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
1916 
1917  SourceLocation getExceptLoc() const { return Loc; }
1918  SourceLocation getEndLoc() const { return getBlock()->getLocEnd(); }
1919 
1920  Expr *getFilterExpr() const {
1921  return reinterpret_cast<Expr*>(Children[FILTER_EXPR]);
1922  }
1923 
1925  return cast<CompoundStmt>(Children[BLOCK]);
1926  }
1927 
1929  return child_range(Children,Children+2);
1930  }
1931 
1932  static bool classof(const Stmt *T) {
1933  return T->getStmtClass() == SEHExceptStmtClass;
1934  }
1935 };
1936 
1937 class SEHFinallyStmt : public Stmt {
1938  friend class ASTReader;
1939  friend class ASTStmtReader;
1940 
1941  SourceLocation Loc;
1942  Stmt *Block;
1943 
1944  SEHFinallyStmt(SourceLocation Loc, Stmt *Block);
1945  explicit SEHFinallyStmt(EmptyShell E) : Stmt(SEHFinallyStmtClass, E) {}
1946 
1947 public:
1948  static SEHFinallyStmt* Create(const ASTContext &C,
1949  SourceLocation FinallyLoc,
1950  Stmt *Block);
1951 
1952  SourceLocation getLocStart() const LLVM_READONLY { return getFinallyLoc(); }
1953  SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
1954 
1955  SourceLocation getFinallyLoc() const { return Loc; }
1956  SourceLocation getEndLoc() const { return Block->getLocEnd(); }
1957 
1958  CompoundStmt *getBlock() const { return cast<CompoundStmt>(Block); }
1959 
1961  return child_range(&Block,&Block+1);
1962  }
1963 
1964  static bool classof(const Stmt *T) {
1965  return T->getStmtClass() == SEHFinallyStmtClass;
1966  }
1967 };
1968 
1969 class SEHTryStmt : public Stmt {
1970  friend class ASTReader;
1971  friend class ASTStmtReader;
1972 
1973  bool IsCXXTry;
1974  SourceLocation TryLoc;
1975  Stmt *Children[2];
1976 
1977  enum { TRY = 0, HANDLER = 1 };
1978 
1979  SEHTryStmt(bool isCXXTry, // true if 'try' otherwise '__try'
1980  SourceLocation TryLoc,
1981  Stmt *TryBlock,
1982  Stmt *Handler);
1983 
1984  explicit SEHTryStmt(EmptyShell E) : Stmt(SEHTryStmtClass, E) {}
1985 
1986 public:
1987  static SEHTryStmt* Create(const ASTContext &C, bool isCXXTry,
1988  SourceLocation TryLoc, Stmt *TryBlock,
1989  Stmt *Handler);
1990 
1991  SourceLocation getLocStart() const LLVM_READONLY { return getTryLoc(); }
1992  SourceLocation getLocEnd() const LLVM_READONLY { return getEndLoc(); }
1993 
1994  SourceLocation getTryLoc() const { return TryLoc; }
1995  SourceLocation getEndLoc() const { return Children[HANDLER]->getLocEnd(); }
1996 
1997  bool getIsCXXTry() const { return IsCXXTry; }
1998 
2000  return cast<CompoundStmt>(Children[TRY]);
2001  }
2002 
2003  Stmt *getHandler() const { return Children[HANDLER]; }
2004 
2005  /// Returns 0 if not defined
2006  SEHExceptStmt *getExceptHandler() const;
2007  SEHFinallyStmt *getFinallyHandler() const;
2008 
2010  return child_range(Children,Children+2);
2011  }
2012 
2013  static bool classof(const Stmt *T) {
2014  return T->getStmtClass() == SEHTryStmtClass;
2015  }
2016 };
2017 
2018 /// Represents a __leave statement.
2019 class SEHLeaveStmt : public Stmt {
2020  SourceLocation LeaveLoc;
2021 
2022 public:
2024  : Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}
2025 
2026  /// \brief Build an empty __leave statement.
2027  explicit SEHLeaveStmt(EmptyShell Empty) : Stmt(SEHLeaveStmtClass, Empty) {}
2028 
2029  SourceLocation getLeaveLoc() const { return LeaveLoc; }
2030  void setLeaveLoc(SourceLocation L) { LeaveLoc = L; }
2031 
2032  SourceLocation getLocStart() const LLVM_READONLY { return LeaveLoc; }
2033  SourceLocation getLocEnd() const LLVM_READONLY { return LeaveLoc; }
2034 
2035  static bool classof(const Stmt *T) {
2036  return T->getStmtClass() == SEHLeaveStmtClass;
2037  }
2038 
2039  // Iterators
2042  }
2043 };
2044 
2045 /// \brief This captures a statement into a function. For example, the following
2046 /// pragma annotated compound statement can be represented as a CapturedStmt,
2047 /// and this compound statement is the body of an anonymous outlined function.
2048 /// @code
2049 /// #pragma omp parallel
2050 /// {
2051 /// compute();
2052 /// }
2053 /// @endcode
2054 class CapturedStmt : public Stmt {
2055 public:
2056  /// \brief The different capture forms: by 'this', by reference, capture for
2057  /// variable-length array type etc.
2063  };
2064 
2065  /// \brief Describes the capture of either a variable, or 'this', or
2066  /// variable-length array type.
2067  class Capture {
2068  llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
2069  SourceLocation Loc;
2070 
2071  public:
2072  friend class ASTStmtReader;
2073 
2074  /// \brief Create a new capture.
2075  ///
2076  /// \param Loc The source location associated with this capture.
2077  ///
2078  /// \param Kind The kind of capture (this, ByRef, ...).
2079  ///
2080  /// \param Var The variable being captured, or null if capturing this.
2082  VarDecl *Var = nullptr);
2083 
2084  /// \brief Determine the kind of capture.
2085  VariableCaptureKind getCaptureKind() const;
2086 
2087  /// \brief Retrieve the source location at which the variable or 'this' was
2088  /// first used.
2089  SourceLocation getLocation() const { return Loc; }
2090 
2091  /// \brief Determine whether this capture handles the C++ 'this' pointer.
2092  bool capturesThis() const { return getCaptureKind() == VCK_This; }
2093 
2094  /// \brief Determine whether this capture handles a variable (by reference).
2095  bool capturesVariable() const { return getCaptureKind() == VCK_ByRef; }
2096 
2097  /// \brief Determine whether this capture handles a variable by copy.
2098  bool capturesVariableByCopy() const {
2099  return getCaptureKind() == VCK_ByCopy;
2100  }
2101 
2102  /// \brief Determine whether this capture handles a variable-length array
2103  /// type.
2105  return getCaptureKind() == VCK_VLAType;
2106  }
2107 
2108  /// \brief Retrieve the declaration of the variable being captured.
2109  ///
2110  /// This operation is only valid if this capture captures a variable.
2111  VarDecl *getCapturedVar() const;
2112  };
2113 
2114 private:
2115  /// \brief The number of variable captured, including 'this'.
2116  unsigned NumCaptures;
2117 
2118  /// \brief The pointer part is the implicit the outlined function and the
2119  /// int part is the captured region kind, 'CR_Default' etc.
2120  llvm::PointerIntPair<CapturedDecl *, 1, CapturedRegionKind> CapDeclAndKind;
2121 
2122  /// \brief The record for captured variables, a RecordDecl or CXXRecordDecl.
2123  RecordDecl *TheRecordDecl = nullptr;
2124 
2125  /// \brief Construct a captured statement.
2127  ArrayRef<Expr *> CaptureInits, CapturedDecl *CD, RecordDecl *RD);
2128 
2129  /// \brief Construct an empty captured statement.
2130  CapturedStmt(EmptyShell Empty, unsigned NumCaptures);
2131 
2132  Stmt **getStoredStmts() { return reinterpret_cast<Stmt **>(this + 1); }
2133 
2134  Stmt *const *getStoredStmts() const {
2135  return reinterpret_cast<Stmt *const *>(this + 1);
2136  }
2137 
2138  Capture *getStoredCaptures() const;
2139 
2140  void setCapturedStmt(Stmt *S) { getStoredStmts()[NumCaptures] = S; }
2141 
2142 public:
2143  friend class ASTStmtReader;
2144 
2145  static CapturedStmt *Create(const ASTContext &Context, Stmt *S,
2146  CapturedRegionKind Kind,
2147  ArrayRef<Capture> Captures,
2148  ArrayRef<Expr *> CaptureInits,
2149  CapturedDecl *CD, RecordDecl *RD);
2150 
2151  static CapturedStmt *CreateDeserialized(const ASTContext &Context,
2152  unsigned NumCaptures);
2153 
2154  /// \brief Retrieve the statement being captured.
2155  Stmt *getCapturedStmt() { return getStoredStmts()[NumCaptures]; }
2156  const Stmt *getCapturedStmt() const { return getStoredStmts()[NumCaptures]; }
2157 
2158  /// \brief Retrieve the outlined function declaration.
2159  CapturedDecl *getCapturedDecl();
2160  const CapturedDecl *getCapturedDecl() const;
2161 
2162  /// \brief Set the outlined function declaration.
2163  void setCapturedDecl(CapturedDecl *D);
2164 
2165  /// \brief Retrieve the captured region kind.
2166  CapturedRegionKind getCapturedRegionKind() const;
2167 
2168  /// \brief Set the captured region kind.
2169  void setCapturedRegionKind(CapturedRegionKind Kind);
2170 
2171  /// \brief Retrieve the record declaration for captured variables.
2172  const RecordDecl *getCapturedRecordDecl() const { return TheRecordDecl; }
2173 
2174  /// \brief Set the record declaration for captured variables.
2176  assert(D && "null RecordDecl");
2177  TheRecordDecl = D;
2178  }
2179 
2180  /// \brief True if this variable has been captured.
2181  bool capturesVariable(const VarDecl *Var) const;
2182 
2183  /// \brief An iterator that walks over the captures.
2186  using capture_range = llvm::iterator_range<capture_iterator>;
2187  using capture_const_range = llvm::iterator_range<const_capture_iterator>;
2188 
2190  return capture_range(capture_begin(), capture_end());
2191  }
2193  return capture_const_range(capture_begin(), capture_end());
2194  }
2195 
2196  /// \brief Retrieve an iterator pointing to the first capture.
2197  capture_iterator capture_begin() { return getStoredCaptures(); }
2198  const_capture_iterator capture_begin() const { return getStoredCaptures(); }
2199 
2200  /// \brief Retrieve an iterator pointing past the end of the sequence of
2201  /// captures.
2203  return getStoredCaptures() + NumCaptures;
2204  }
2205 
2206  /// \brief Retrieve the number of captures, including 'this'.
2207  unsigned capture_size() const { return NumCaptures; }
2208 
2209  /// \brief Iterator that walks over the capture initialization arguments.
2211  using capture_init_range = llvm::iterator_range<capture_init_iterator>;
2212 
2213  /// \brief Const iterator that walks over the capture initialization
2214  /// arguments.
2216  using const_capture_init_range =
2217  llvm::iterator_range<const_capture_init_iterator>;
2218 
2220  return capture_init_range(capture_init_begin(), capture_init_end());
2221  }
2222 
2224  return const_capture_init_range(capture_init_begin(), capture_init_end());
2225  }
2226 
2227  /// \brief Retrieve the first initialization argument.
2229  return reinterpret_cast<Expr **>(getStoredStmts());
2230  }
2231 
2233  return reinterpret_cast<Expr *const *>(getStoredStmts());
2234  }
2235 
2236  /// \brief Retrieve the iterator pointing one past the last initialization
2237  /// argument.
2239  return capture_init_begin() + NumCaptures;
2240  }
2241 
2243  return capture_init_begin() + NumCaptures;
2244  }
2245 
2246  SourceLocation getLocStart() const LLVM_READONLY {
2247  return getCapturedStmt()->getLocStart();
2248  }
2249 
2250  SourceLocation getLocEnd() const LLVM_READONLY {
2251  return getCapturedStmt()->getLocEnd();
2252  }
2253 
2254  SourceRange getSourceRange() const LLVM_READONLY {
2255  return getCapturedStmt()->getSourceRange();
2256  }
2257 
2258  static bool classof(const Stmt *T) {
2259  return T->getStmtClass() == CapturedStmtClass;
2260  }
2261 
2263 };
2264 
2265 } // namespace clang
2266 
2267 #endif // LLVM_CLANG_AST_STMT_H
SourceLocation getRParenLoc() const
Definition: Stmt.h:1184
child_iterator child_begin()
Definition: Stmt.h:452
Expr * getInc()
Definition: Stmt.h:1237
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1517
void setThen(Stmt *S)
Definition: Stmt.h:968
SourceLocation getStartLoc() const
Definition: Stmt.h:511
GotoStmt(EmptyShell Empty)
Build an empty goto statement.
Definition: Stmt.h:1284
SourceLocation getRBracLoc() const
Definition: Stmt.h:678
APFloatSemantics
Definition: Stmt.h:159
IdentifierInfo * getInputIdentifier(unsigned i) const
Definition: Stmt.h:1734
DoStmt(Stmt *body, Expr *cond, SourceLocation DL, SourceLocation WL, SourceLocation RP)
Definition: Stmt.h:1162
static bool classof(const Stmt *T)
Definition: Stmt.h:1001
child_range children()
Definition: Stmt.h:1088
SourceLocation getRParenLoc() const
Definition: Stmt.h:1637
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:1616
Stmt * body_back()
Definition: Stmt.h:628
const Stmt * getElse() const
Definition: Stmt.h:969
body_iterator body_end()
Definition: Stmt.h:626
unsigned getNumInputs() const
Definition: Stmt.h:1532
CompoundStmt * getBlock() const
Definition: Stmt.h:1958
SourceLocation getForLoc() const
Definition: Stmt.h:1250
const Stmt * getBody() const
Definition: Stmt.h:1176
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument.
Definition: Stmt.h:2228
capture_const_range captures() const
Definition: Stmt.h:2192
const_child_iterator child_end() const
Definition: Stmt.h:456
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1915
ConstExprIterator(const Stmt *const *I)
Definition: Stmt.h:351
DefaultStmt(SourceLocation DL, SourceLocation CL, Stmt *substmt)
Definition: Stmt.h:804
SourceLocation getEllipsisLoc() const
Definition: Stmt.h:756
void setNRVOCandidate(const VarDecl *Var)
Definition: Stmt.h:1441
static bool classof(const Stmt *T)
Definition: Stmt.h:1887
Expr * getCond()
Definition: Stmt.h:1127
__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:1565
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:1129
unsigned getNumAsmToks()
Definition: Stmt.h:1825
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:666
outputs_iterator end_outputs()
Definition: Stmt.h:1590
const DeclStmt * getConditionVariableDeclStmt() const
If this ForStmt has a condition variable, return the faux DeclStmt associated with the creation of th...
Definition: Stmt.h:1232
IndirectGotoStmt(EmptyShell Empty)
Build an empty indirect goto statement.
Definition: Stmt.h:1320
std::reverse_iterator< const_body_iterator > const_reverse_body_iterator
Definition: Stmt.h:664
Stmt - This represents one statement.
Definition: Stmt.h:66
IfStmt - This represents an if/then/else.
Definition: Stmt.h:929
AsmStmt(StmtClass SC, EmptyShell Empty)
Build an empty inline-assembly statement.
Definition: Stmt.h:1489
bool capturesThis() const
Determine whether this capture handles the C++ &#39;this&#39; pointer.
Definition: Stmt.h:2092
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:726
unsigned getNumOutputs() const
Definition: Stmt.h:1510
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1501
llvm::iterator_range< body_iterator > body_range
Definition: Stmt.h:622
ContinueStmt(EmptyShell Empty)
Build an empty continue statement.
Definition: Stmt.h:1358
const StringLiteral * getAsmString() const
Definition: Stmt.h:1642
void setRParenLoc(SourceLocation L)
Definition: Stmt.h:1638
void setContinueLoc(SourceLocation L)
Definition: Stmt.h:1361
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:1843
SourceLocation getIdentLoc() const
Definition: Stmt.h:855
Represents an attribute applied to a statement.
Definition: Stmt.h:878
const Expr * getOutputExpr(unsigned i) const
Definition: Stmt.h:1728
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:1392
void setCond(Expr *E)
Definition: Stmt.h:1174
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:2172
DeclRefExprBitfields DeclRefExprBits
Definition: Stmt.h:292
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1239
unsigned NumOutputs
Definition: Stmt.h:1475
bool getIsCXXTry() const
Definition: Stmt.h:1997
child_range children()
Definition: Stmt.h:2040
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:1056
NullStmt(SourceLocation L, bool hasLeadingEmptyMacro=false)
Definition: Stmt.h:570
void setStartLoc(SourceLocation L)
Definition: Stmt.h:512
SourceLocation getGotoLoc() const
Definition: Stmt.h:1324
void setForLoc(SourceLocation L)
Definition: Stmt.h:1251
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:1443
WhileStmt(EmptyShell Empty)
Build an empty while statement.
Definition: Stmt.h:1108
const_child_iterator child_begin() const
Definition: Stmt.h:455
Stmt * getSubStmt()
Definition: Stmt.h:811
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:781
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Definition: Decl.h:807
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization. ...
Definition: Stmt.h:1440
SourceLocation getLParenLoc() const
Definition: Stmt.h:1252
static bool classof(const Stmt *T)
Definition: Stmt.h:680
void setInit(Stmt *S)
Definition: Stmt.h:964
void setAsmLoc(SourceLocation L)
Definition: Stmt.h:1492
ExprIterator(Stmt **I)
Definition: Stmt.h:336
const_outputs_iterator begin_outputs() const
Definition: Stmt.h:1598
const Expr * getCond() const
Definition: Stmt.h:1241
Stmt * getThen()
Definition: Stmt.h:973
SourceLocation getIfLoc() const
Definition: Stmt.h:976
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:2197
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:1738
void setBody(Stmt *S, SourceLocation SL)
Definition: Stmt.h:1061
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:1363
Stmt(StmtClass SC, EmptyShell)
Construct an empty statement.
Definition: Stmt.h:366
void setTarget(Expr *E)
Definition: Stmt.h:1330
CoawaitExprBitfields CoawaitBits
Definition: Stmt.h:300
static bool classof(const Stmt *T)
Definition: Stmt.h:2013
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:839
RecordDecl - Represents a struct/union/class.
Definition: Decl.h:3482
Represents a C99 designated initializer expression.
Definition: Expr.h:4106
const Expr * getTarget() const
Definition: Stmt.h:1329
inputs_iterator begin_inputs()
Definition: Stmt.h:1557
SourceLocation getColonLoc() const
Definition: Stmt.h:817
One of these records is kept for each identifier that is lexed.
Stmt * getBody()
Definition: Stmt.h:1175
const_outputs_iterator end_outputs() const
Definition: Stmt.h:1602
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:3533
SourceLocation ColonLoc
Definition: Stmt.h:702
DeclGroupRef::const_iterator const_decl_iterator
Definition: Stmt.h:530
void setInit(Stmt *S)
Definition: Stmt.h:1044
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:1960
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:1914
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:1952
const_body_iterator body_begin() const
Definition: Stmt.h:642
SourceLocation getEndLoc() const
Definition: Stmt.h:513
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:779
LabelStmt(SourceLocation IL, LabelDecl *D, Stmt *substmt)
Definition: Stmt.h:845
CharSourceRange getRange() const
Definition: Stmt.h:1683
CharacterLiteralBitfields CharacterLiteralBits
Definition: Stmt.h:289
ArrayRef< Expr * > getAllExprs() const
Definition: Stmt.h:1871
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:2032
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:1991
SourceLocation getEndLoc() const
Definition: Stmt.h:1995
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:627
void setReturnLoc(SourceLocation L)
Definition: Stmt.h:1433
llvm::iterator_range< const_inputs_iterator > inputs_const_range
Definition: Stmt.h:1555
MSAsmStmt(EmptyShell Empty)
Build an empty MS-style inline-assembly statement.
Definition: Stmt.h:1816
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1885
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:1079
static bool classof(const Stmt *T)
Definition: Stmt.h:1545
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
Definition: ExprObjC.h:171
child_range children()
Definition: Stmt.h:1891
void setSubStmt(Stmt *S)
Definition: Stmt.h:775
child_range children()
Definition: Stmt.h:1195
SwitchCase(StmtClass SC, SourceLocation KWLoc, SourceLocation ColonLoc)
Definition: Stmt.h:704
const Stmt * getSubStmt() const
Definition: Stmt.h:860
void addSwitchCase(SwitchCase *SC)
Definition: Stmt.h:1066
child_range children()
Definition: Stmt.h:589
child_range children()
Definition: Stmt.h:2009
void setBody(Stmt *S)
Definition: Stmt.h:1052
static bool classof(const Stmt *T)
Definition: Stmt.h:1143
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:1308
Describes an C or C++ initializer list.
Definition: Expr.h:3872
SwitchCase(StmtClass SC, EmptyShell)
Definition: Stmt.h:707
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
Definition: Stmt.h:2215
GCCAsmStmt(EmptyShell Empty)
Build an empty inline-assembly statement.
Definition: Stmt.h:1635
child_range children()
Definition: Stmt.h:921
ForStmt - This represents a &#39;for (init;cond;inc)&#39; stmt.
Definition: Stmt.h:1203
outputs_iterator begin_outputs()
Definition: Stmt.h:1586
void setCond(Expr *E)
Definition: Stmt.h:1050
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:856
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SourceLocation getLBracLoc() const
Definition: Stmt.h:677
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:2250
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:1238
llvm::iterator_range< const_outputs_iterator > outputs_const_range
Definition: Stmt.h:1584
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:1339
Stmt * getInit()
Definition: Stmt.h:1217
iterator begin()
Definition: DeclGroup.h:100
const StringLiteral * getInputConstraintLiteral(unsigned i) const
Definition: Stmt.h:1747
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1393
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:1294
child_range children()
Definition: Stmt.h:867
void setAsmString(StringLiteral *E)
Definition: Stmt.h:1644
static bool classof(const Stmt *T)
Definition: Stmt.h:1449
AsmStmt(StmtClass SC, SourceLocation asmloc, bool issimple, bool isvolatile, unsigned numoutputs, unsigned numinputs, unsigned numclobbers)
Definition: Stmt.h:1481
const Stmt * getInit() const
Definition: Stmt.h:1043
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:1884
const Expr * getInc() const
Definition: Stmt.h:1242
Expr * getCond()
Definition: Stmt.h:1236
SourceLocation getContinueLoc() const
Definition: Stmt.h:1360
void setLHS(Expr *Val)
Definition: Stmt.h:776
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:1132
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1295
StringLiteral * getClobberStringLiteral(unsigned i)
Definition: Stmt.h:1781
StringRef getOutputName(unsigned i) const
Definition: Stmt.h:1710
void setCond(Expr *E)
Definition: Stmt.h:1246
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:675
bool isOutputPlusConstraint(unsigned i) const
isOutputPlusConstraint - Return true if the specified output constraint is a "+" constraint (which is...
Definition: Stmt.h:1520
decl_iterator decl_end()
Definition: Stmt.h:539
const Expr * getCond() const
Definition: Stmt.h:1128
SourceLocation getTryLoc() const
Definition: Stmt.h:1994
void setEndLoc(SourceLocation L)
Definition: Stmt.h:1821
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:685
This represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:3860
StmtClass
Definition: Stmt.h:68
Stmt * getBody()
Definition: Stmt.h:1051
const Expr * getLHS() const
Definition: Stmt.h:765
Stmt * getInit()
Definition: Stmt.h:962
const_body_iterator body_end() const
Definition: Stmt.h:643
Iterator for iterating over Stmt * arrays that contain only Expr *.
Definition: Stmt.h:332
unsigned NumClobbers
Definition: Stmt.h:1477
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:1257
const_decl_iterator decl_begin() const
Definition: Stmt.h:540
StringLiteral * getAsmString()
Definition: Stmt.h:1643
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:818
child_range children()
Definition: Stmt.h:795
llvm::iterator_range< const_child_iterator > const_child_range
Definition: Stmt.h:444
void setBreakLoc(SourceLocation L)
Definition: Stmt.h:1390
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:595
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1992
Describes the capture of either a variable, or &#39;this&#39;, or variable-length array type.
Definition: Stmt.h:2067
Stmt * stripLabelLikeStatements()
Definition: Stmt.h:432
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:986
Decl * getSingleDecl()
Definition: Stmt.h:505
static bool classof(const Stmt *T)
Definition: Stmt.h:1342
const_inputs_iterator begin_inputs() const
Definition: Stmt.h:1567
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:1500
child_range children()
Definition: Stmt.h:1610
bool IsVolatile
If true, treat this inline assembly as having side effects.
Definition: Stmt.h:1473
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2031
static bool classof(const Stmt *T)
Definition: Stmt.h:1932
static bool classof(const Stmt *T)
Definition: Stmt.h:1263
bool isConstexpr() const
Definition: Stmt.h:981
unsigned getOperandNo() const
Definition: Stmt.h:1678
const DeclStmt * getConditionVariableDeclStmt() const
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
Definition: Stmt.h:958
SourceLocation getLabelLoc() const
Definition: Stmt.h:1291
llvm::iterator_range< const_capture_iterator > capture_const_range
Definition: Stmt.h:2187
void setLeaveLoc(SourceLocation L)
Definition: Stmt.h:2030
const Stmt * getSubStmt() const
Definition: Stmt.h:916
const Stmt * getSubStmt() const
Definition: Stmt.h:812
void setRParenLoc(SourceLocation L)
Definition: Stmt.h:1185
SourceLocation getFinallyLoc() const
Definition: Stmt.h:1955
GotoStmt(LabelDecl *label, SourceLocation GL, SourceLocation LL)
Definition: Stmt.h:1280
Expr - This represents one expression.
Definition: Expr.h:106
SourceRange getSourceRange() const LLVM_READONLY
Definition: Stmt.h:2254
SourceLocation getElseLoc() const
Definition: Stmt.h:978
SourceLocation End
void setWhileLoc(SourceLocation L)
Definition: Stmt.h:1135
Represents a character-granular source range.
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:918
inputs_const_range inputs() const
Definition: Stmt.h:1575
llvm::iterator_range< const_capture_init_iterator > const_capture_init_range
Definition: Stmt.h:2217
ArrayRef< StringRef > getClobbers() const
Definition: Stmt.h:1867
std::string Label
InitListExprBitfields InitListExprBits
Definition: Stmt.h:298
static bool classof(const Stmt *T)
Definition: Stmt.h:2035
StringRef getClobber(unsigned i) const
Definition: Stmt.h:1876
const FunctionProtoType * T
SourceLocation getDefaultLoc() const
Definition: Stmt.h:815
void setLParenLoc(SourceLocation L)
Definition: Stmt.h:1253
const StringLiteral * getClobberStringLiteral(unsigned i) const
Definition: Stmt.h:1782
SourceLocation getWhileLoc() const
Definition: Stmt.h:1134
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1953
const Stmt * getThen() const
Definition: Stmt.h:967
AsmStringPiece - this is part of a decomposed asm string specification (for use with the AnalyzeAsmSt...
Definition: Stmt.h:1649
const Expr * getInputExpr(unsigned i) const
Definition: Stmt.h:1757
const Stmt * getCapturedStmt() const
Definition: Stmt.h:2156
void setInc(Expr *E)
Definition: Stmt.h:1247
Stmt * getBody()
Definition: Stmt.h:1130
SourceLocation KeywordLoc
Definition: Stmt.h:701
void setRetValue(Expr *E)
Definition: Stmt.h:1430
void setBody(Stmt *S)
Definition: Stmt.h:1248
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:288
Expr * getRHS()
Definition: Stmt.h:762
ExprBitfields ExprBits
Definition: Stmt.h:288
void setColonLoc(SourceLocation L)
Definition: Stmt.h:759
SourceLocation Begin
child_range children()
Definition: Stmt.h:997
unsigned size() const
Definition: Stmt.h:619
ExprWithCleanupsBitfields ExprWithCleanupsBits
Definition: Stmt.h:295
std::reverse_iterator< body_iterator > reverse_body_iterator
Definition: Stmt.h:653
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:2219
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:2033
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:1665
ForStmt(EmptyShell Empty)
Build an empty for statement.
Definition: Stmt.h:1215
SourceLocation getSwitchLoc() const
Definition: Stmt.h:1058
StringLiteral * getOutputConstraintLiteral(unsigned i)
Definition: Stmt.h:1722
LabelDecl * getLabel() const
Definition: Stmt.h:1286
child_range children()
Definition: Stmt.h:1347
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
Definition: Stmt.h:1413
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:1795
void setColonLoc(SourceLocation L)
Definition: Stmt.h:719
SourceLocation getDoLoc() const
Definition: Stmt.h:1179
SwitchCase * getSwitchCaseList()
Definition: Stmt.h:1053
llvm::iterator_range< const_decl_iterator > decl_const_range
Definition: Stmt.h:532
child_range children()
Definition: Stmt.h:828
child_range children()
Definition: Stmt.h:1371
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:1081
Expr * getCond()
Definition: Stmt.h:972
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:517
static bool classof(const Stmt *T)
Definition: Stmt.h:1297
Stmt *const * const_body_iterator
Definition: Stmt.h:635
const SourceManager & SM
Definition: Format.cpp:1337
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1188
const_inputs_iterator end_inputs() const
Definition: Stmt.h:1571
const Expr * getCond() const
Definition: Stmt.h:1173
DoStmt - This represents a &#39;do/while&#39; stmt.
Definition: Stmt.h:1154
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition: Stmt.h:1461
child_range children()
Definition: Stmt.h:1400
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:1918
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:857
static bool classof(const Stmt *T)
Definition: Stmt.h:2258
Kind
void setElse(Stmt *S)
Definition: Stmt.h:970
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:2054
Token * getAsmToks()
Definition: Stmt.h:1826
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:4969
void setSubStmt(Stmt *S)
Definition: Stmt.h:813
void setGotoLoc(SourceLocation L)
Definition: Stmt.h:1323
CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc, SourceLocation ellipsisLoc, SourceLocation colonLoc)
Definition: Stmt.h:742
Encodes a location in the source.
body_range body()
Definition: Stmt.h:624
StringRef getOutputConstraint(unsigned i) const
Definition: Stmt.h:1836
PseudoObjectExprBitfields PseudoObjectExprBits
Definition: Stmt.h:296
IfStmtBitfields IfStmtBits
Definition: Stmt.h:287
SEHLeaveStmt(EmptyShell Empty)
Build an empty __leave statement.
Definition: Stmt.h:2027
const SwitchCase * getSwitchCaseList() const
Definition: Stmt.h:1047
void setDoLoc(SourceLocation L)
Definition: Stmt.h:1180
child_range children()
Definition: Stmt.h:1928
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:1842
Expr * getLHS()
Definition: Stmt.h:761
void setLastStmt(Stmt *S)
Definition: Stmt.h:630
ArrayRef< const Attr * > getAttrs() const
Definition: Stmt.h:911
void setConstexpr(bool C)
Definition: Stmt.h:982
SourceLocation getExceptLoc() const
Definition: Stmt.h:1917
const_capture_iterator capture_begin() const
Definition: Stmt.h:2198
void setIdentLoc(SourceLocation L)
Definition: Stmt.h:861
Stmt * getElse()
Definition: Stmt.h:974
const_child_range children() const
Definition: Stmt.h:689
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Definition: Stmt.h:487
LabelDecl - Represents the declaration of a label.
Definition: Decl.h:460
bool capturesVariable() const
Determine whether this capture handles a variable (by reference).
Definition: Stmt.h:2095
reverse_body_iterator body_rend()
Definition: Stmt.h:659
SourceLocation getLBraceLoc() const
Definition: Stmt.h:1818
const std::string & getString() const
Definition: Stmt.h:1674
CaseStmt(EmptyShell Empty)
Build an empty switch case statement.
Definition: Stmt.h:752
Expr * getCond()
Definition: Stmt.h:1049
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:1075
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:674
CompoundStmt(SourceLocation Loc)
Definition: Stmt.h:606
void setCond(Expr *E)
Definition: Stmt.h:966
reference operator*() const
Definition: Stmt.h:338
static bool classof(const Stmt *T)
Definition: Stmt.h:1395
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:1289
reverse_decl_iterator decl_rbegin()
Definition: Stmt.h:545
SEHLeaveStmt(SourceLocation LL)
Definition: Stmt.h:2023
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
Definition: Stmt.h:1719
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition: Stmt.h:2155
const Stmt * body_front() const
Definition: Stmt.h:645
unsigned capture_size() const
Retrieve the number of captures, including &#39;this&#39;.
Definition: Stmt.h:2207
const Stmt * getBody() const
Definition: Stmt.h:1243
void setCaseLoc(SourceLocation L)
Definition: Stmt.h:755
SourceLocation getEndLoc() const
Definition: Stmt.h:1820
LabelStmt(EmptyShell Empty)
Definition: Stmt.h:853
const_capture_init_range capture_inits() const
Definition: Stmt.h:2223
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1445
SourceLocation getKeywordLoc() const
Definition: Stmt.h:716
SourceLocation getStarLoc() const
Definition: Stmt.h:1326
const DeclStmt * getConditionVariableDeclStmt() const
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
Definition: Stmt.h:1123
void setCapturedRecordDecl(RecordDecl *D)
Set the record declaration for captured variables.
Definition: Stmt.h:2175
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:1495
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:2854
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:1786
IfStmt(EmptyShell Empty)
Build an empty if/then/else statement.
Definition: Stmt.h:943
const_child_range children() const
Definition: Stmt.h:447
void setGotoLoc(SourceLocation L)
Definition: Stmt.h:1290
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:556
StringRef getInputConstraint(unsigned i) const
Definition: Stmt.h:1849
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:1497
child_range children()
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:988
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1787
IdentifierInfo * getOutputIdentifier(unsigned i) const
Definition: Stmt.h:1706
bool isSimple() const
Definition: Stmt.h:1494
llvm::iterator_range< outputs_iterator > outputs_range
Definition: Stmt.h:1583
SourceRange getSourceRange(const SourceRange &Range)
Returns the SourceRange of a SourceRange.
Definition: FixIt.h:34
const Stmt * body_back() const
Definition: Stmt.h:649
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:729
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:1137
DoStmt(EmptyShell Empty)
Build an empty do-while statement.
Definition: Stmt.h:1170
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1083
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:821
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1364
Stmt * getHandler() const
Definition: Stmt.h:2003
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:712
bool isSingleDecl() const
Definition: DeclGroup.h:81
static bool classof(const Stmt *T)
Definition: Stmt.h:1964
void setEllipsisLoc(SourceLocation L)
Definition: Stmt.h:757
const Decl * getSingleDecl() const
Definition: Stmt.h:504
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1340
ReturnStmt(SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
Definition: Stmt.h:1421
static bool classof(const Stmt *T)
Definition: Stmt.h:1789
BreakStmt(EmptyShell Empty)
Build an empty break statement.
Definition: Stmt.h:1387
child_range children()
Definition: Stmt.h:1302
const Stmt * getSubStmt() const
Definition: Stmt.h:722
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:625
static bool classof(const Stmt *T)
Definition: Stmt.h:519
void setBody(Stmt *S)
Definition: Stmt.h:1177
IndirectGotoStmt(SourceLocation gotoLoc, SourceLocation starLoc, Expr *target)
Definition: Stmt.h:1314
const Stmt * getBody() const
Definition: Stmt.h:1046
llvm::iterator_range< const_body_iterator > body_const_range
Definition: Stmt.h:636
Represents a __leave statement.
Definition: Stmt.h:2019
bool capturesVariableByCopy() const
Determine whether this capture handles a variable by copy.
Definition: Stmt.h:2098
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:1007
bool body_empty() const
Definition: Stmt.h:618
SourceLocation getLeaveLoc() const
Definition: Stmt.h:2029
bool hasBraces() const
Definition: Stmt.h:1823
const_capture_init_iterator capture_init_end() const
Definition: Stmt.h:2242
void setRHS(Expr *Val)
Definition: Stmt.h:777
void setVolatile(bool V)
Definition: Stmt.h:1498
static bool classof(const Stmt *T)
Definition: Stmt.h:869
DefaultStmt(EmptyShell Empty)
Build an empty default statement.
Definition: Stmt.h:808
reverse_decl_iterator decl_rend()
Definition: Stmt.h:549
StringLiteral * getInputConstraintLiteral(unsigned i)
Definition: Stmt.h:1750
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:1857
TypeTraitExprBitfields TypeTraitExprBits
Definition: Stmt.h:299
void setSwitchLoc(SourceLocation L)
Definition: Stmt.h:1059
Stmt * getInit()
Definition: Stmt.h:1042
const Stmt * IgnoreImplicit() const
Definition: Stmt.h:420
static bool classof(const Stmt *T)
Definition: Stmt.h:823
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:919
decl_range decls()
Definition: Stmt.h:534
AsmStringPiece(unsigned OpNo, const std::string &S, SourceLocation Begin, SourceLocation End)
Definition: Stmt.h:1666
bool IsSimple
True if the assembly statement does not have any input or output operands.
Definition: Stmt.h:1469
static bool classof(const Stmt *T)
Definition: Stmt.h:923
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:2246
StringRef getAsmString() const
Definition: Stmt.h:1829
ArrayRef< StringRef > getAllConstraints() const
Definition: Stmt.h:1863
UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits
Definition: Stmt.h:291
SourceLocation getColonLoc() const
Definition: Stmt.h:718
unsigned getNumClobbers() const
Definition: Stmt.h:1542
ReturnStmt(SourceLocation RL)
Definition: Stmt.h:1419
SourceLocation getRParenLoc() const
Definition: Stmt.h:1254
child_range children()
Definition: Stmt.h:1148
void setStarLoc(SourceLocation L)
Definition: Stmt.h:1325
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:1491
outputs_range outputs()
Definition: Stmt.h:1594
GotoStmt - This represents a direct goto.
Definition: Stmt.h:1274
Expr * getTarget()
Definition: Stmt.h:1328
Decl *const * const_iterator
Definition: DeclGroup.h:78
const SwitchCase * getNextSwitchCase() const
Definition: Stmt.h:710
SwitchStmt(EmptyShell Empty)
Build a empty switch statement.
Definition: Stmt.h:1022
Expr * getCond()
Definition: Stmt.h:1172
static bool classof(const Stmt *T)
Definition: Stmt.h:1190
llvm::iterator_range< capture_iterator > capture_range
Definition: Stmt.h:2186
SourceLocation getWhileLoc() const
Definition: Stmt.h:1181
Defines the clang::SourceLocation class and associated facilities.
llvm::iterator_range< inputs_iterator > inputs_range
Definition: Stmt.h:1554
ContinueStmt - This represents a continue.
Definition: Stmt.h:1351
const_decl_iterator decl_end() const
Definition: Stmt.h:541
const Expr * getRHS() const
Definition: Stmt.h:769
reverse_body_iterator body_rbegin()
Definition: Stmt.h:655
void setLBraceLoc(SourceLocation L)
Definition: Stmt.h:1819
child_range children()
Definition: Stmt.h:524
Expr * getFilterExpr() const
Definition: Stmt.h:1920
void setElseLoc(SourceLocation L)
Definition: Stmt.h:979
SourceLocation getAttrLoc() const
Definition: Stmt.h:910
ContinueStmt(SourceLocation CL)
Definition: Stmt.h:1355
const Stmt * getInit() const
Definition: Stmt.h:1240
OpenMPLinearClauseKind getModifier() const
Return modifier.
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:1187
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:1098
llvm::iterator_range< capture_init_iterator > capture_init_range
Definition: Stmt.h:2211
void setIfLoc(SourceLocation L)
Definition: Stmt.h:977
SourceLocation AsmLoc
Definition: Stmt.h:1465
static bool classof(const Stmt *T)
Definition: Stmt.h:1366
CompoundStmt(EmptyShell Empty)
Definition: Stmt.h:612
const Stmt * getSubStmt() const
Definition: Stmt.h:773
void setDefaultLoc(SourceLocation L)
Definition: Stmt.h:816
SourceLocation getBreakLoc() const
Definition: Stmt.h:1389
SourceLocation getCaseLoc() const
Definition: Stmt.h:754
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of captures.
Definition: Stmt.h:2202
VariableCaptureKind
The different capture forms: by &#39;this&#39;, by reference, capture for variable-length array type etc...
Definition: Stmt.h:2058
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:1092
void setRParenLoc(SourceLocation L)
Definition: Stmt.h:1255
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1139
void setNextSwitchCase(SwitchCase *SC)
Definition: Stmt.h:714
child_range children()
Definition: Stmt.h:1268
body_const_range body() const
Definition: Stmt.h:638
capture_range captures()
Definition: Stmt.h:2189
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:956
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:865
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:864
SourceLocation getColonLoc() const
Definition: Stmt.h:758
void setLabel(LabelDecl *D)
Definition: Stmt.h:1287
static bool classof(const Stmt *T)
Definition: Stmt.h:790
BreakStmt - This represents a break.
Definition: Stmt.h:1377
const Stmt * getInit() const
Definition: Stmt.h:963
void setSubStmt(Stmt *SS)
Definition: Stmt.h:862
CallExprBitfields CallExprBits
Definition: Stmt.h:294
CapturedRegionKind
The different kinds of captured statement.
Definition: CapturedStmt.h:17
const Stmt * getBody() const
Definition: Stmt.h:1131
CastExprBitfields CastExprBits
Definition: Stmt.h:293
Stmt * getSubStmt()
Definition: Stmt.h:859
DeclStmt(DeclGroupRef dg, SourceLocation startLoc, SourceLocation endLoc)
Definition: Stmt.h:492
const Expr * getCond() const
Definition: Stmt.h:965
SourceLocation getLocStart() const LLVM_READONLY
Definition: Stmt.h:820
A trivial tuple used to represent a source range.
void setInit(Stmt *S)
Definition: Stmt.h:1245
unsigned NumInputs
Definition: Stmt.h:1476
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:670
const Expr * getCond() const
Definition: Stmt.h:1045
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument.
Definition: Stmt.h:2238
SourceLocation ColonLoc
Location of &#39;:&#39;.
Definition: OpenMPClause.h:93
void setWhileLoc(SourceLocation L)
Definition: Stmt.h:1182
child_range children()
Definition: Stmt.h:1454
This class handles loading and caching of source files into memory.
BreakStmt(SourceLocation BL)
Definition: Stmt.h:1381
CompoundStmt * getTryBlock() const
Definition: Stmt.h:1999
Stmt * getSubStmt()
Definition: Stmt.h:915
CompoundStmt * getBlock() const
Definition: Stmt.h:1924
void setKeywordLoc(SourceLocation L)
Definition: Stmt.h:717
SourceLocation getReturnLoc() const
Definition: Stmt.h:1432
ReturnStmt(EmptyShell Empty)
Build an empty return expression.
Definition: Stmt.h:1426
bool capturesVariableArrayType() const
Determine whether this capture handles a variable-length array type.
Definition: Stmt.h:2104
Attr - This represents one attribute.
Definition: Attr.h:43
SourceLocation getLocEnd() const LLVM_READONLY
Definition: Stmt.h:1259
void setLabelLoc(SourceLocation L)
Definition: Stmt.h:1292
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:1956
const_capture_init_iterator capture_init_begin() const
Definition: Stmt.h:2232
SourceLocation getLocation() const
Retrieve the source location at which the variable or &#39;this&#39; was first used.
Definition: Stmt.h:2089
Stmt * getSubStmt()
Definition: Stmt.h:763
const DeclStmt * getConditionVariableDeclStmt() const
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
Definition: Stmt.h:1038
inputs_iterator end_inputs()
Definition: Stmt.h:1561
outputs_const_range outputs() const
Definition: Stmt.h:1606
const LabelDecl * getConstantTarget() const
Definition: Stmt.h:1335