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