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