clang  10.0.0svn
Stmt.h
Go to the documentation of this file.
1 //===- Stmt.h - Classes for representing statements -------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the Stmt interface and subclasses.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_AST_STMT_H
14 #define LLVM_CLANG_AST_STMT_H
15 
16 #include "clang/AST/DeclGroup.h"
17 #include "clang/AST/StmtIterator.h"
20 #include "clang/Basic/LLVM.h"
22 #include "llvm/ADT/ArrayRef.h"
23 #include "llvm/ADT/PointerIntPair.h"
24 #include "llvm/ADT/StringRef.h"
25 #include "llvm/ADT/iterator.h"
26 #include "llvm/ADT/iterator_range.h"
27 #include "llvm/Support/Casting.h"
28 #include "llvm/Support/Compiler.h"
29 #include "llvm/Support/ErrorHandling.h"
30 #include <algorithm>
31 #include <cassert>
32 #include <cstddef>
33 #include <iterator>
34 #include <string>
35 
36 namespace llvm {
37 
38 class FoldingSetNodeID;
39 
40 } // namespace llvm
41 
42 namespace clang {
43 
44 class ASTContext;
45 class Attr;
46 class CapturedDecl;
47 class Decl;
48 class Expr;
49 class AddrLabelExpr;
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  //===--- Statement bitfields classes ---===//
93 
94  class StmtBitfields {
95  friend class ASTStmtReader;
96  friend class ASTStmtWriter;
97  friend class Stmt;
98 
99  /// The statement class.
100  unsigned sClass : 8;
101 
102  /// This bit is set only for the Stmts that are the structured-block of
103  /// OpenMP executable directives. Directives that have a structured block
104  /// are called "non-standalone" directives.
105  /// I.e. those returned by OMPExecutableDirective::getStructuredBlock().
106  unsigned IsOMPStructuredBlock : 1;
107  };
108  enum { NumStmtBits = 9 };
109 
111  friend class ASTStmtReader;
112  friend class ASTStmtWriter;
113  friend class NullStmt;
114 
115  unsigned : NumStmtBits;
116 
117  /// True if the null statement was preceded by an empty macro, e.g:
118  /// @code
119  /// #define CALL(x)
120  /// CALL(0);
121  /// @endcode
122  unsigned HasLeadingEmptyMacro : 1;
123 
124  /// The location of the semi-colon.
125  SourceLocation SemiLoc;
126  };
127 
129  friend class ASTStmtReader;
130  friend class CompoundStmt;
131 
132  unsigned : NumStmtBits;
133 
134  unsigned NumStmts : 32 - NumStmtBits;
135 
136  /// The location of the opening "{".
137  SourceLocation LBraceLoc;
138  };
139 
141  friend class LabelStmt;
142 
143  unsigned : NumStmtBits;
144 
145  SourceLocation IdentLoc;
146  };
147 
149  friend class ASTStmtReader;
150  friend class AttributedStmt;
151 
152  unsigned : NumStmtBits;
153 
154  /// Number of attributes.
155  unsigned NumAttrs : 32 - NumStmtBits;
156 
157  /// The location of the attribute.
158  SourceLocation AttrLoc;
159  };
160 
162  friend class ASTStmtReader;
163  friend class IfStmt;
164 
165  unsigned : NumStmtBits;
166 
167  /// True if this if statement is a constexpr if.
168  unsigned IsConstexpr : 1;
169 
170  /// True if this if statement has storage for an else statement.
171  unsigned HasElse : 1;
172 
173  /// True if this if statement has storage for a variable declaration.
174  unsigned HasVar : 1;
175 
176  /// True if this if statement has storage for an init statement.
177  unsigned HasInit : 1;
178 
179  /// The location of the "if".
180  SourceLocation IfLoc;
181  };
182 
184  friend class SwitchStmt;
185 
186  unsigned : NumStmtBits;
187 
188  /// True if the SwitchStmt has storage for an init statement.
189  unsigned HasInit : 1;
190 
191  /// True if the SwitchStmt has storage for a condition variable.
192  unsigned HasVar : 1;
193 
194  /// If the SwitchStmt is a switch on an enum value, records whether all
195  /// the enum values were covered by CaseStmts. The coverage information
196  /// value is meant to be a hint for possible clients.
197  unsigned AllEnumCasesCovered : 1;
198 
199  /// The location of the "switch".
200  SourceLocation SwitchLoc;
201  };
202 
204  friend class ASTStmtReader;
205  friend class WhileStmt;
206 
207  unsigned : NumStmtBits;
208 
209  /// True if the WhileStmt has storage for a condition variable.
210  unsigned HasVar : 1;
211 
212  /// The location of the "while".
213  SourceLocation WhileLoc;
214  };
215 
217  friend class DoStmt;
218 
219  unsigned : NumStmtBits;
220 
221  /// The location of the "do".
222  SourceLocation DoLoc;
223  };
224 
226  friend class ForStmt;
227 
228  unsigned : NumStmtBits;
229 
230  /// The location of the "for".
231  SourceLocation ForLoc;
232  };
233 
235  friend class GotoStmt;
236  friend class IndirectGotoStmt;
237 
238  unsigned : NumStmtBits;
239 
240  /// The location of the "goto".
241  SourceLocation GotoLoc;
242  };
243 
245  friend class ContinueStmt;
246 
247  unsigned : NumStmtBits;
248 
249  /// The location of the "continue".
250  SourceLocation ContinueLoc;
251  };
252 
254  friend class BreakStmt;
255 
256  unsigned : NumStmtBits;
257 
258  /// The location of the "break".
259  SourceLocation BreakLoc;
260  };
261 
263  friend class ReturnStmt;
264 
265  unsigned : NumStmtBits;
266 
267  /// True if this ReturnStmt has storage for an NRVO candidate.
268  unsigned HasNRVOCandidate : 1;
269 
270  /// The location of the "return".
271  SourceLocation RetLoc;
272  };
273 
275  friend class SwitchCase;
276  friend class CaseStmt;
277 
278  unsigned : NumStmtBits;
279 
280  /// Used by CaseStmt to store whether it is a case statement
281  /// of the form case LHS ... RHS (a GNU extension).
282  unsigned CaseStmtIsGNURange : 1;
283 
284  /// The location of the "case" or "default" keyword.
285  SourceLocation KeywordLoc;
286  };
287 
288  //===--- Expression bitfields classes ---===//
289 
291  friend class ASTStmtReader; // deserialization
292  friend class AtomicExpr; // ctor
293  friend class BlockDeclRefExpr; // ctor
294  friend class CallExpr; // ctor
295  friend class CXXConstructExpr; // ctor
296  friend class CXXDependentScopeMemberExpr; // ctor
297  friend class CXXNewExpr; // ctor
298  friend class CXXUnresolvedConstructExpr; // ctor
299  friend class DeclRefExpr; // computeDependence
300  friend class DependentScopeDeclRefExpr; // ctor
301  friend class DesignatedInitExpr; // ctor
302  friend class Expr;
303  friend class InitListExpr; // ctor
304  friend class ObjCArrayLiteral; // ctor
305  friend class ObjCDictionaryLiteral; // ctor
306  friend class ObjCMessageExpr; // ctor
307  friend class OffsetOfExpr; // ctor
308  friend class OpaqueValueExpr; // ctor
309  friend class OverloadExpr; // ctor
310  friend class ParenListExpr; // ctor
311  friend class PseudoObjectExpr; // ctor
312  friend class ShuffleVectorExpr; // ctor
313 
314  unsigned : NumStmtBits;
315 
316  unsigned ValueKind : 2;
317  unsigned ObjectKind : 3;
318  unsigned TypeDependent : 1;
319  unsigned ValueDependent : 1;
320  unsigned InstantiationDependent : 1;
321  unsigned ContainsUnexpandedParameterPack : 1;
322  };
323  enum { NumExprBits = NumStmtBits + 9 };
324 
326  friend class ASTStmtReader;
327  friend class ASTStmtWriter;
328  friend class ConstantExpr;
329 
330  unsigned : NumExprBits;
331 
332  /// The kind of result that is trail-allocated.
333  unsigned ResultKind : 2;
334 
335  /// Kind of Result as defined by APValue::Kind
336  unsigned APValueKind : 4;
337 
338  /// When ResultKind == RSK_Int64. whether the trail-allocated integer is
339  /// signed.
340  unsigned IsUnsigned : 1;
341 
342  /// When ResultKind == RSK_Int64. the BitWidth of the trail-allocated
343  /// integer. 7 bits because it is the minimal number of bit to represent a
344  /// value from 0 to 64 (the size of the trail-allocated number).
345  unsigned BitWidth : 7;
346 
347  /// When ResultKind == RSK_APValue. Wether the ASTContext will cleanup the
348  /// destructor on the trail-allocated APValue.
349  unsigned HasCleanup : 1;
350  };
351 
353  friend class ASTStmtReader;
354  friend class PredefinedExpr;
355 
356  unsigned : NumExprBits;
357 
358  /// The kind of this PredefinedExpr. One of the enumeration values
359  /// in PredefinedExpr::IdentKind.
360  unsigned Kind : 4;
361 
362  /// True if this PredefinedExpr has a trailing "StringLiteral *"
363  /// for the predefined identifier.
364  unsigned HasFunctionName : 1;
365 
366  /// The location of this PredefinedExpr.
367  SourceLocation Loc;
368  };
369 
371  friend class ASTStmtReader; // deserialization
372  friend class DeclRefExpr;
373 
374  unsigned : NumExprBits;
375 
376  unsigned HasQualifier : 1;
377  unsigned HasTemplateKWAndArgsInfo : 1;
378  unsigned HasFoundDecl : 1;
379  unsigned HadMultipleCandidates : 1;
380  unsigned RefersToEnclosingVariableOrCapture : 1;
381  unsigned NonOdrUseReason : 2;
382 
383  /// The location of the declaration name itself.
384  SourceLocation Loc;
385  };
386 
387 
389  friend class FloatingLiteral;
390 
391  unsigned : NumExprBits;
392 
393  unsigned Semantics : 3; // Provides semantics for APFloat construction
394  unsigned IsExact : 1;
395  };
396 
398  friend class ASTStmtReader;
399  friend class StringLiteral;
400 
401  unsigned : NumExprBits;
402 
403  /// The kind of this string literal.
404  /// One of the enumeration values of StringLiteral::StringKind.
405  unsigned Kind : 3;
406 
407  /// The width of a single character in bytes. Only values of 1, 2,
408  /// and 4 bytes are supported. StringLiteral::mapCharByteWidth maps
409  /// the target + string kind to the appropriate CharByteWidth.
410  unsigned CharByteWidth : 3;
411 
412  unsigned IsPascal : 1;
413 
414  /// The number of concatenated token this string is made of.
415  /// This is the number of trailing SourceLocation.
416  unsigned NumConcatenated;
417  };
418 
420  friend class CharacterLiteral;
421 
422  unsigned : NumExprBits;
423 
424  unsigned Kind : 3;
425  };
426 
428  friend class UnaryOperator;
429 
430  unsigned : NumExprBits;
431 
432  unsigned Opc : 5;
433  unsigned CanOverflow : 1;
434 
435  SourceLocation Loc;
436  };
437 
440 
441  unsigned : NumExprBits;
442 
443  unsigned Kind : 3;
444  unsigned IsType : 1; // true if operand is a type, false if an expression.
445  };
446 
448  friend class ArraySubscriptExpr;
449 
450  unsigned : NumExprBits;
451 
452  SourceLocation RBracketLoc;
453  };
454 
456  friend class CallExpr;
457 
458  unsigned : NumExprBits;
459 
460  unsigned NumPreArgs : 1;
461 
462  /// True if the callee of the call expression was found using ADL.
463  unsigned UsesADL : 1;
464 
465  /// Padding used to align OffsetToTrailingObjects to a byte multiple.
466  unsigned : 24 - 2 - NumExprBits;
467 
468  /// The offset in bytes from the this pointer to the start of the
469  /// trailing objects belonging to CallExpr. Intentionally byte sized
470  /// for faster access.
471  unsigned OffsetToTrailingObjects : 8;
472  };
473  enum { NumCallExprBits = 32 };
474 
476  friend class ASTStmtReader;
477  friend class MemberExpr;
478 
479  unsigned : NumExprBits;
480 
481  /// IsArrow - True if this is "X->F", false if this is "X.F".
482  unsigned IsArrow : 1;
483 
484  /// True if this member expression used a nested-name-specifier to
485  /// refer to the member, e.g., "x->Base::f", or found its member via
486  /// a using declaration. When true, a MemberExprNameQualifier
487  /// structure is allocated immediately after the MemberExpr.
488  unsigned HasQualifierOrFoundDecl : 1;
489 
490  /// True if this member expression specified a template keyword
491  /// and/or a template argument list explicitly, e.g., x->f<int>,
492  /// x->template f, x->template f<int>.
493  /// When true, an ASTTemplateKWAndArgsInfo structure and its
494  /// TemplateArguments (if any) are present.
495  unsigned HasTemplateKWAndArgsInfo : 1;
496 
497  /// True if this member expression refers to a method that
498  /// was resolved from an overloaded set having size greater than 1.
499  unsigned HadMultipleCandidates : 1;
500 
501  /// Value of type NonOdrUseReason indicating why this MemberExpr does
502  /// not constitute an odr-use of the named declaration. Meaningful only
503  /// when naming a static member.
504  unsigned NonOdrUseReason : 2;
505 
506  /// This is the location of the -> or . in the expression.
507  SourceLocation OperatorLoc;
508  };
509 
511  friend class CastExpr;
512  friend class ImplicitCastExpr;
513 
514  unsigned : NumExprBits;
515 
516  unsigned Kind : 6;
517  unsigned PartOfExplicitCast : 1; // Only set for ImplicitCastExpr.
518 
519  /// The number of CXXBaseSpecifiers in the cast. 14 bits would be enough
520  /// here. ([implimits] Direct and indirect base classes [16384]).
521  unsigned BasePathSize;
522  };
523 
525  friend class BinaryOperator;
526 
527  unsigned : NumExprBits;
528 
529  unsigned Opc : 6;
530 
531  /// This is only meaningful for operations on floating point
532  /// types and 0 otherwise.
533  unsigned FPFeatures : 3;
534 
535  SourceLocation OpLoc;
536  };
537 
539  friend class InitListExpr;
540 
541  unsigned : NumExprBits;
542 
543  /// Whether this initializer list originally had a GNU array-range
544  /// designator in it. This is a temporary marker used by CodeGen.
545  unsigned HadArrayRangeDesignator : 1;
546  };
547 
549  friend class ASTStmtReader;
550  friend class ParenListExpr;
551 
552  unsigned : NumExprBits;
553 
554  /// The number of expressions in the paren list.
555  unsigned NumExprs;
556  };
557 
559  friend class ASTStmtReader;
560  friend class GenericSelectionExpr;
561 
562  unsigned : NumExprBits;
563 
564  /// The location of the "_Generic".
565  SourceLocation GenericLoc;
566  };
567 
569  friend class ASTStmtReader; // deserialization
570  friend class PseudoObjectExpr;
571 
572  unsigned : NumExprBits;
573 
574  // These don't need to be particularly wide, because they're
575  // strictly limited by the forms of expressions we permit.
576  unsigned NumSubExprs : 8;
577  unsigned ResultIndex : 32 - 8 - NumExprBits;
578  };
579 
581  friend class ASTStmtReader;
582  friend class SourceLocExpr;
583 
584  unsigned : NumExprBits;
585 
586  /// The kind of source location builtin represented by the SourceLocExpr.
587  /// Ex. __builtin_LINE, __builtin_FUNCTION, ect.
588  unsigned Kind : 2;
589  };
590 
591  //===--- C++ Expression bitfields classes ---===//
592 
594  friend class ASTStmtReader;
595  friend class CXXOperatorCallExpr;
596 
597  unsigned : NumCallExprBits;
598 
599  /// The kind of this overloaded operator. One of the enumerator
600  /// value of OverloadedOperatorKind.
601  unsigned OperatorKind : 6;
602 
603  // Only meaningful for floating point types.
604  unsigned FPFeatures : 3;
605  };
606 
608  friend class ASTStmtReader;
610 
611  unsigned : NumCallExprBits;
612 
613  unsigned IsReversed : 1;
614  };
615 
617  friend class CXXBoolLiteralExpr;
618 
619  unsigned : NumExprBits;
620 
621  /// The value of the boolean literal.
622  unsigned Value : 1;
623 
624  /// The location of the boolean literal.
625  SourceLocation Loc;
626  };
627 
629  friend class CXXNullPtrLiteralExpr;
630 
631  unsigned : NumExprBits;
632 
633  /// The location of the null pointer literal.
634  SourceLocation Loc;
635  };
636 
638  friend class CXXThisExpr;
639 
640  unsigned : NumExprBits;
641 
642  /// Whether this is an implicit "this".
643  unsigned IsImplicit : 1;
644 
645  /// The location of the "this".
646  SourceLocation Loc;
647  };
648 
650  friend class ASTStmtReader;
651  friend class CXXThrowExpr;
652 
653  unsigned : NumExprBits;
654 
655  /// Whether the thrown variable (if any) is in scope.
656  unsigned IsThrownVariableInScope : 1;
657 
658  /// The location of the "throw".
659  SourceLocation ThrowLoc;
660  };
661 
663  friend class ASTStmtReader;
664  friend class CXXDefaultArgExpr;
665 
666  unsigned : NumExprBits;
667 
668  /// The location where the default argument expression was used.
669  SourceLocation Loc;
670  };
671 
673  friend class ASTStmtReader;
674  friend class CXXDefaultInitExpr;
675 
676  unsigned : NumExprBits;
677 
678  /// The location where the default initializer expression was used.
679  SourceLocation Loc;
680  };
681 
683  friend class ASTStmtReader;
685 
686  unsigned : NumExprBits;
687 
688  SourceLocation RParenLoc;
689  };
690 
692  friend class ASTStmtReader;
693  friend class ASTStmtWriter;
694  friend class CXXNewExpr;
695 
696  unsigned : NumExprBits;
697 
698  /// Was the usage ::new, i.e. is the global new to be used?
699  unsigned IsGlobalNew : 1;
700 
701  /// Do we allocate an array? If so, the first trailing "Stmt *" is the
702  /// size expression.
703  unsigned IsArray : 1;
704 
705  /// Should the alignment be passed to the allocation function?
706  unsigned ShouldPassAlignment : 1;
707 
708  /// If this is an array allocation, does the usual deallocation
709  /// function for the allocated type want to know the allocated size?
710  unsigned UsualArrayDeleteWantsSize : 1;
711 
712  /// What kind of initializer do we have? Could be none, parens, or braces.
713  /// In storage, we distinguish between "none, and no initializer expr", and
714  /// "none, but an implicit initializer expr".
715  unsigned StoredInitializationStyle : 2;
716 
717  /// True if the allocated type was expressed as a parenthesized type-id.
718  unsigned IsParenTypeId : 1;
719 
720  /// The number of placement new arguments.
721  unsigned NumPlacementArgs;
722  };
723 
725  friend class ASTStmtReader;
726  friend class CXXDeleteExpr;
727 
728  unsigned : NumExprBits;
729 
730  /// Is this a forced global delete, i.e. "::delete"?
731  unsigned GlobalDelete : 1;
732 
733  /// Is this the array form of delete, i.e. "delete[]"?
734  unsigned ArrayForm : 1;
735 
736  /// ArrayFormAsWritten can be different from ArrayForm if 'delete' is
737  /// applied to pointer-to-array type (ArrayFormAsWritten will be false
738  /// while ArrayForm will be true).
739  unsigned ArrayFormAsWritten : 1;
740 
741  /// Does the usual deallocation function for the element type require
742  /// a size_t argument?
743  unsigned UsualArrayDeleteWantsSize : 1;
744 
745  /// Location of the expression.
746  SourceLocation Loc;
747  };
748 
750  friend class ASTStmtReader;
751  friend class ASTStmtWriter;
752  friend class TypeTraitExpr;
753 
754  unsigned : NumExprBits;
755 
756  /// The kind of type trait, which is a value of a TypeTrait enumerator.
757  unsigned Kind : 8;
758 
759  /// If this expression is not value-dependent, this indicates whether
760  /// the trait evaluated true or false.
761  unsigned Value : 1;
762 
763  /// The number of arguments to this type trait.
764  unsigned NumArgs : 32 - 8 - 1 - NumExprBits;
765  };
766 
768  friend class ASTStmtReader;
769  friend class ASTStmtWriter;
771 
772  unsigned : NumExprBits;
773 
774  /// Whether the name includes info for explicit template
775  /// keyword and arguments.
776  unsigned HasTemplateKWAndArgsInfo : 1;
777  };
778 
780  friend class ASTStmtReader;
781  friend class CXXConstructExpr;
782 
783  unsigned : NumExprBits;
784 
785  unsigned Elidable : 1;
786  unsigned HadMultipleCandidates : 1;
787  unsigned ListInitialization : 1;
788  unsigned StdInitListInitialization : 1;
789  unsigned ZeroInitialization : 1;
790  unsigned ConstructionKind : 3;
791 
792  SourceLocation Loc;
793  };
794 
796  friend class ASTStmtReader; // deserialization
797  friend class ExprWithCleanups;
798 
799  unsigned : NumExprBits;
800 
801  // When false, it must not have side effects.
802  unsigned CleanupsHaveSideEffects : 1;
803 
804  unsigned NumObjects : 32 - 1 - NumExprBits;
805  };
806 
808  friend class ASTStmtReader;
810 
811  unsigned : NumExprBits;
812 
813  /// The number of arguments used to construct the type.
814  unsigned NumArgs;
815  };
816 
818  friend class ASTStmtReader;
820 
821  unsigned : NumExprBits;
822 
823  /// Whether this member expression used the '->' operator or
824  /// the '.' operator.
825  unsigned IsArrow : 1;
826 
827  /// Whether this member expression has info for explicit template
828  /// keyword and arguments.
829  unsigned HasTemplateKWAndArgsInfo : 1;
830 
831  /// See getFirstQualifierFoundInScope() and the comment listing
832  /// the trailing objects.
833  unsigned HasFirstQualifierFoundInScope : 1;
834 
835  /// The location of the '->' or '.' operator.
836  SourceLocation OperatorLoc;
837  };
838 
840  friend class ASTStmtReader;
841  friend class OverloadExpr;
842 
843  unsigned : NumExprBits;
844 
845  /// Whether the name includes info for explicit template
846  /// keyword and arguments.
847  unsigned HasTemplateKWAndArgsInfo : 1;
848 
849  /// Padding used by the derived classes to store various bits. If you
850  /// need to add some data here, shrink this padding and add your data
851  /// above. NumOverloadExprBits also needs to be updated.
852  unsigned : 32 - NumExprBits - 1;
853 
854  /// The number of results.
855  unsigned NumResults;
856  };
857  enum { NumOverloadExprBits = NumExprBits + 1 };
858 
860  friend class ASTStmtReader;
861  friend class UnresolvedLookupExpr;
862 
863  unsigned : NumOverloadExprBits;
864 
865  /// True if these lookup results should be extended by
866  /// argument-dependent lookup if this is the operand of a function call.
867  unsigned RequiresADL : 1;
868 
869  /// True if these lookup results are overloaded. This is pretty trivially
870  /// rederivable if we urgently need to kill this field.
871  unsigned Overloaded : 1;
872  };
873  static_assert(sizeof(UnresolvedLookupExprBitfields) <= 4,
874  "UnresolvedLookupExprBitfields must be <= than 4 bytes to"
875  "avoid trashing OverloadExprBitfields::NumResults!");
876 
878  friend class ASTStmtReader;
879  friend class UnresolvedMemberExpr;
880 
881  unsigned : NumOverloadExprBits;
882 
883  /// Whether this member expression used the '->' operator or
884  /// the '.' operator.
885  unsigned IsArrow : 1;
886 
887  /// Whether the lookup results contain an unresolved using declaration.
888  unsigned HasUnresolvedUsing : 1;
889  };
890  static_assert(sizeof(UnresolvedMemberExprBitfields) <= 4,
891  "UnresolvedMemberExprBitfields must be <= than 4 bytes to"
892  "avoid trashing OverloadExprBitfields::NumResults!");
893 
895  friend class ASTStmtReader;
896  friend class CXXNoexceptExpr;
897 
898  unsigned : NumExprBits;
899 
900  unsigned Value : 1;
901  };
902 
904  friend class ASTStmtReader;
906 
907  unsigned : NumExprBits;
908 
909  /// The location of the non-type template parameter reference.
910  SourceLocation NameLoc;
911  };
912 
913  //===--- C++ Coroutines TS bitfields classes ---===//
914 
916  friend class CoawaitExpr;
917 
918  unsigned : NumExprBits;
919 
920  unsigned IsImplicit : 1;
921  };
922 
923  //===--- Obj-C Expression bitfields classes ---===//
924 
927 
928  unsigned : NumExprBits;
929 
930  unsigned ShouldCopy : 1;
931  };
932 
933  //===--- Clang Extensions bitfields classes ---===//
934 
936  friend class ASTStmtReader;
937  friend class OpaqueValueExpr;
938 
939  unsigned : NumExprBits;
940 
941  /// The OVE is a unique semantic reference to its source expression if this
942  /// bit is set to true.
943  unsigned IsUnique : 1;
944 
945  SourceLocation Loc;
946  };
947 
948  union {
949  // Same order as in StmtNodes.td.
950  // Statements
966 
967  // Expressions
987 
988  // C++ Expressions
1011 
1012  // C++ Coroutines TS expressions
1014 
1015  // Obj-C Expressions
1017 
1018  // Clang Extensions
1020  };
1021 
1022 public:
1023  // Only allow allocation of Stmts using the allocator in ASTContext
1024  // or by doing a placement new.
1025  void* operator new(size_t bytes, const ASTContext& C,
1026  unsigned alignment = 8);
1027 
1028  void* operator new(size_t bytes, const ASTContext* C,
1029  unsigned alignment = 8) {
1030  return operator new(bytes, *C, alignment);
1031  }
1032 
1033  void *operator new(size_t bytes, void *mem) noexcept { return mem; }
1034 
1035  void operator delete(void *, const ASTContext &, unsigned) noexcept {}
1036  void operator delete(void *, const ASTContext *, unsigned) noexcept {}
1037  void operator delete(void *, size_t) noexcept {}
1038  void operator delete(void *, void *) noexcept {}
1039 
1040 public:
1041  /// A placeholder type used to construct an empty shell of a
1042  /// type, that will be filled in later (e.g., by some
1043  /// de-serialization).
1044  struct EmptyShell {};
1045 
1046 protected:
1047  /// Iterator for iterating over Stmt * arrays that contain only T *.
1048  ///
1049  /// This is needed because AST nodes use Stmt* arrays to store
1050  /// references to children (to be compatible with StmtIterator).
1051  template<typename T, typename TPtr = T *, typename StmtPtr = Stmt *>
1053  : llvm::iterator_adaptor_base<CastIterator<T, TPtr, StmtPtr>, StmtPtr *,
1054  std::random_access_iterator_tag, TPtr> {
1055  using Base = typename CastIterator::iterator_adaptor_base;
1056 
1057  CastIterator() : Base(nullptr) {}
1058  CastIterator(StmtPtr *I) : Base(I) {}
1059 
1060  typename Base::value_type operator*() const {
1061  return cast_or_null<T>(*this->I);
1062  }
1063  };
1064 
1065  /// Const iterator for iterating over Stmt * arrays that contain only T *.
1066  template <typename T>
1068 
1071 
1072 private:
1073  /// Whether statistic collection is enabled.
1074  static bool StatisticsEnabled;
1075 
1076 protected:
1077  /// Construct an empty statement.
1078  explicit Stmt(StmtClass SC, EmptyShell) : Stmt(SC) {}
1079 
1080 public:
1081  Stmt() = delete;
1082  Stmt(const Stmt &) = delete;
1083  Stmt(Stmt &&) = delete;
1084  Stmt &operator=(const Stmt &) = delete;
1085  Stmt &operator=(Stmt &&) = delete;
1086 
1088  static_assert(sizeof(*this) <= 8,
1089  "changing bitfields changed sizeof(Stmt)");
1090  static_assert(sizeof(*this) % alignof(void *) == 0,
1091  "Insufficient alignment!");
1092  StmtBits.sClass = SC;
1093  StmtBits.IsOMPStructuredBlock = false;
1094  if (StatisticsEnabled) Stmt::addStmtClass(SC);
1095  }
1096 
1098  return static_cast<StmtClass>(StmtBits.sClass);
1099  }
1100 
1101  const char *getStmtClassName() const;
1102 
1103  bool isOMPStructuredBlock() const { return StmtBits.IsOMPStructuredBlock; }
1104  void setIsOMPStructuredBlock(bool IsOMPStructuredBlock) {
1105  StmtBits.IsOMPStructuredBlock = IsOMPStructuredBlock;
1106  }
1107 
1108  /// SourceLocation tokens are not useful in isolation - they are low level
1109  /// value objects created/interpreted by SourceManager. We assume AST
1110  /// clients will have a pointer to the respective SourceManager.
1111  SourceRange getSourceRange() const LLVM_READONLY;
1112  SourceLocation getBeginLoc() const LLVM_READONLY;
1113  SourceLocation getEndLoc() const LLVM_READONLY;
1114 
1115  // global temp stats (until we have a per-module visitor)
1116  static void addStmtClass(const StmtClass s);
1117  static void EnableStatistics();
1118  static void PrintStats();
1119 
1120  /// Dumps the specified AST fragment and all subtrees to
1121  /// \c llvm::errs().
1122  void dump() const;
1123  void dump(SourceManager &SM) const;
1124  void dump(raw_ostream &OS, SourceManager &SM) const;
1125  void dump(raw_ostream &OS) const;
1126 
1127  /// \return Unique reproducible object identifier
1128  int64_t getID(const ASTContext &Context) const;
1129 
1130  /// dumpColor - same as dump(), but forces color highlighting.
1131  void dumpColor() const;
1132 
1133  /// dumpPretty/printPretty - These two methods do a "pretty print" of the AST
1134  /// back to its original source language syntax.
1135  void dumpPretty(const ASTContext &Context) const;
1136  void printPretty(raw_ostream &OS, PrinterHelper *Helper,
1137  const PrintingPolicy &Policy, unsigned Indentation = 0,
1138  StringRef NewlineSymbol = "\n",
1139  const ASTContext *Context = nullptr) const;
1140 
1141  /// Pretty-prints in JSON format.
1142  void printJson(raw_ostream &Out, PrinterHelper *Helper,
1143  const PrintingPolicy &Policy, bool AddQuotes) const;
1144 
1145  /// viewAST - Visualize an AST rooted at this Stmt* using GraphViz. Only
1146  /// works on systems with GraphViz (Mac OS X) or dot+gv installed.
1147  void viewAST() const;
1148 
1149  /// Skip no-op (attributed, compound) container stmts and skip captured
1150  /// stmt at the top, if \a IgnoreCaptured is true.
1151  Stmt *IgnoreContainers(bool IgnoreCaptured = false);
1152  const Stmt *IgnoreContainers(bool IgnoreCaptured = false) const {
1153  return const_cast<Stmt *>(this)->IgnoreContainers(IgnoreCaptured);
1154  }
1155 
1156  const Stmt *stripLabelLikeStatements() const;
1158  return const_cast<Stmt*>(
1159  const_cast<const Stmt*>(this)->stripLabelLikeStatements());
1160  }
1161 
1162  /// Child Iterators: All subclasses must implement 'children'
1163  /// to permit easy iteration over the substatements/subexpessions of an
1164  /// AST node. This permits easy iteration over all nodes in the AST.
1167 
1168  using child_range = llvm::iterator_range<child_iterator>;
1169  using const_child_range = llvm::iterator_range<const_child_iterator>;
1170 
1172 
1174  auto Children = const_cast<Stmt *>(this)->children();
1175  return const_child_range(Children.begin(), Children.end());
1176  }
1177 
1178  child_iterator child_begin() { return children().begin(); }
1179  child_iterator child_end() { return children().end(); }
1180 
1181  const_child_iterator child_begin() const { return children().begin(); }
1182  const_child_iterator child_end() const { return children().end(); }
1183 
1184  /// Produce a unique representation of the given statement.
1185  ///
1186  /// \param ID once the profiling operation is complete, will contain
1187  /// the unique representation of the given statement.
1188  ///
1189  /// \param Context the AST context in which the statement resides
1190  ///
1191  /// \param Canonical whether the profile should be based on the canonical
1192  /// representation of this statement (e.g., where non-type template
1193  /// parameters are identified by index/level rather than their
1194  /// declaration pointers) or the exact representation of the statement as
1195  /// written in the source.
1196  void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
1197  bool Canonical) const;
1198 
1199  /// Calculate a unique representation for a statement that is
1200  /// stable across compiler invocations.
1201  ///
1202  /// \param ID profile information will be stored in ID.
1203  ///
1204  /// \param Hash an ODRHash object which will be called where pointers would
1205  /// have been used in the Profile function.
1206  void ProcessODRHash(llvm::FoldingSetNodeID &ID, ODRHash& Hash) const;
1207 };
1208 
1209 /// DeclStmt - Adaptor class for mixing declarations with statements and
1210 /// expressions. For example, CompoundStmt mixes statements, expressions
1211 /// and declarations (variables, types). Another example is ForStmt, where
1212 /// the first statement can be an expression or a declaration.
1213 class DeclStmt : public Stmt {
1214  DeclGroupRef DG;
1215  SourceLocation StartLoc, EndLoc;
1216 
1217 public:
1219  : Stmt(DeclStmtClass), DG(dg), StartLoc(startLoc), EndLoc(endLoc) {}
1220 
1221  /// Build an empty declaration statement.
1222  explicit DeclStmt(EmptyShell Empty) : Stmt(DeclStmtClass, Empty) {}
1223 
1224  /// isSingleDecl - This method returns true if this DeclStmt refers
1225  /// to a single Decl.
1226  bool isSingleDecl() const { return DG.isSingleDecl(); }
1227 
1228  const Decl *getSingleDecl() const { return DG.getSingleDecl(); }
1229  Decl *getSingleDecl() { return DG.getSingleDecl(); }
1230 
1231  const DeclGroupRef getDeclGroup() const { return DG; }
1232  DeclGroupRef getDeclGroup() { return DG; }
1233  void setDeclGroup(DeclGroupRef DGR) { DG = DGR; }
1234 
1235  void setStartLoc(SourceLocation L) { StartLoc = L; }
1236  SourceLocation getEndLoc() const { return EndLoc; }
1237  void setEndLoc(SourceLocation L) { EndLoc = L; }
1238 
1239  SourceLocation getBeginLoc() const LLVM_READONLY { return StartLoc; }
1240 
1241  static bool classof(const Stmt *T) {
1242  return T->getStmtClass() == DeclStmtClass;
1243  }
1244 
1245  // Iterators over subexpressions.
1247  return child_range(child_iterator(DG.begin(), DG.end()),
1248  child_iterator(DG.end(), DG.end()));
1249  }
1250 
1252  auto Children = const_cast<DeclStmt *>(this)->children();
1253  return const_child_range(Children);
1254  }
1255 
1258  using decl_range = llvm::iterator_range<decl_iterator>;
1259  using decl_const_range = llvm::iterator_range<const_decl_iterator>;
1260 
1261  decl_range decls() { return decl_range(decl_begin(), decl_end()); }
1262 
1264  return decl_const_range(decl_begin(), decl_end());
1265  }
1266 
1267  decl_iterator decl_begin() { return DG.begin(); }
1268  decl_iterator decl_end() { return DG.end(); }
1269  const_decl_iterator decl_begin() const { return DG.begin(); }
1270  const_decl_iterator decl_end() const { return DG.end(); }
1271 
1272  using reverse_decl_iterator = std::reverse_iterator<decl_iterator>;
1273 
1275  return reverse_decl_iterator(decl_end());
1276  }
1277 
1279  return reverse_decl_iterator(decl_begin());
1280  }
1281 };
1282 
1283 /// NullStmt - This is the null statement ";": C99 6.8.3p3.
1284 ///
1285 class NullStmt : public Stmt {
1286 public:
1287  NullStmt(SourceLocation L, bool hasLeadingEmptyMacro = false)
1288  : Stmt(NullStmtClass) {
1289  NullStmtBits.HasLeadingEmptyMacro = hasLeadingEmptyMacro;
1290  setSemiLoc(L);
1291  }
1292 
1293  /// Build an empty null statement.
1294  explicit NullStmt(EmptyShell Empty) : Stmt(NullStmtClass, Empty) {}
1295 
1296  SourceLocation getSemiLoc() const { return NullStmtBits.SemiLoc; }
1297  void setSemiLoc(SourceLocation L) { NullStmtBits.SemiLoc = L; }
1298 
1299  bool hasLeadingEmptyMacro() const {
1300  return NullStmtBits.HasLeadingEmptyMacro;
1301  }
1302 
1303  SourceLocation getBeginLoc() const { return getSemiLoc(); }
1304  SourceLocation getEndLoc() const { return getSemiLoc(); }
1305 
1306  static bool classof(const Stmt *T) {
1307  return T->getStmtClass() == NullStmtClass;
1308  }
1309 
1312  }
1313 
1316  }
1317 };
1318 
1319 /// CompoundStmt - This represents a group of statements like { stmt stmt }.
1320 class CompoundStmt final : public Stmt,
1321  private llvm::TrailingObjects<CompoundStmt, Stmt *> {
1322  friend class ASTStmtReader;
1323  friend TrailingObjects;
1324 
1325  /// The location of the closing "}". LBraceLoc is stored in CompoundStmtBits.
1326  SourceLocation RBraceLoc;
1327 
1329  explicit CompoundStmt(EmptyShell Empty) : Stmt(CompoundStmtClass, Empty) {}
1330 
1331  void setStmts(ArrayRef<Stmt *> Stmts);
1332 
1333 public:
1334  static CompoundStmt *Create(const ASTContext &C, ArrayRef<Stmt *> Stmts,
1336 
1337  // Build an empty compound statement with a location.
1339  : Stmt(CompoundStmtClass), RBraceLoc(Loc) {
1340  CompoundStmtBits.NumStmts = 0;
1341  CompoundStmtBits.LBraceLoc = Loc;
1342  }
1343 
1344  // Build an empty compound statement.
1345  static CompoundStmt *CreateEmpty(const ASTContext &C, unsigned NumStmts);
1346 
1347  bool body_empty() const { return CompoundStmtBits.NumStmts == 0; }
1348  unsigned size() const { return CompoundStmtBits.NumStmts; }
1349 
1350  using body_iterator = Stmt **;
1351  using body_range = llvm::iterator_range<body_iterator>;
1352 
1353  body_range body() { return body_range(body_begin(), body_end()); }
1354  body_iterator body_begin() { return getTrailingObjects<Stmt *>(); }
1355  body_iterator body_end() { return body_begin() + size(); }
1356  Stmt *body_front() { return !body_empty() ? body_begin()[0] : nullptr; }
1357 
1359  return !body_empty() ? body_begin()[size() - 1] : nullptr;
1360  }
1361 
1362  using const_body_iterator = Stmt *const *;
1363  using body_const_range = llvm::iterator_range<const_body_iterator>;
1364 
1366  return body_const_range(body_begin(), body_end());
1367  }
1368 
1370  return getTrailingObjects<Stmt *>();
1371  }
1372 
1373  const_body_iterator body_end() const { return body_begin() + size(); }
1374 
1375  const Stmt *body_front() const {
1376  return !body_empty() ? body_begin()[0] : nullptr;
1377  }
1378 
1379  const Stmt *body_back() const {
1380  return !body_empty() ? body_begin()[size() - 1] : nullptr;
1381  }
1382 
1383  using reverse_body_iterator = std::reverse_iterator<body_iterator>;
1384 
1386  return reverse_body_iterator(body_end());
1387  }
1388 
1390  return reverse_body_iterator(body_begin());
1391  }
1392 
1394  std::reverse_iterator<const_body_iterator>;
1395 
1397  return const_reverse_body_iterator(body_end());
1398  }
1399 
1401  return const_reverse_body_iterator(body_begin());
1402  }
1403 
1404  // Get the Stmt that StmtExpr would consider to be the result of this
1405  // compound statement. This is used by StmtExpr to properly emulate the GCC
1406  // compound expression extension, which ignores trailing NullStmts when
1407  // getting the result of the expression.
1408  // i.e. ({ 5;;; })
1409  // ^^ ignored
1410  // If we don't find something that isn't a NullStmt, just return the last
1411  // Stmt.
1413  for (auto *B : llvm::reverse(body())) {
1414  if (!isa<NullStmt>(B))
1415  return B;
1416  }
1417  return body_back();
1418  }
1419 
1420  const Stmt *getStmtExprResult() const {
1421  return const_cast<CompoundStmt *>(this)->getStmtExprResult();
1422  }
1423 
1424  SourceLocation getBeginLoc() const { return CompoundStmtBits.LBraceLoc; }
1425  SourceLocation getEndLoc() const { return RBraceLoc; }
1426 
1427  SourceLocation getLBracLoc() const { return CompoundStmtBits.LBraceLoc; }
1428  SourceLocation getRBracLoc() const { return RBraceLoc; }
1429 
1430  static bool classof(const Stmt *T) {
1431  return T->getStmtClass() == CompoundStmtClass;
1432  }
1433 
1434  // Iterators
1435  child_range children() { return child_range(body_begin(), body_end()); }
1436 
1438  return const_child_range(body_begin(), body_end());
1439  }
1440 };
1441 
1442 // SwitchCase is the base class for CaseStmt and DefaultStmt,
1443 class SwitchCase : public Stmt {
1444 protected:
1445  /// The location of the ":".
1447 
1448  // The location of the "case" or "default" keyword. Stored in SwitchCaseBits.
1449  // SourceLocation KeywordLoc;
1450 
1451  /// A pointer to the following CaseStmt or DefaultStmt class,
1452  /// used by SwitchStmt.
1453  SwitchCase *NextSwitchCase = nullptr;
1454 
1456  : Stmt(SC), ColonLoc(ColonLoc) {
1457  setKeywordLoc(KWLoc);
1458  }
1459 
1461 
1462 public:
1463  const SwitchCase *getNextSwitchCase() const { return NextSwitchCase; }
1464  SwitchCase *getNextSwitchCase() { return NextSwitchCase; }
1465  void setNextSwitchCase(SwitchCase *SC) { NextSwitchCase = SC; }
1466 
1467  SourceLocation getKeywordLoc() const { return SwitchCaseBits.KeywordLoc; }
1468  void setKeywordLoc(SourceLocation L) { SwitchCaseBits.KeywordLoc = L; }
1470  void setColonLoc(SourceLocation L) { ColonLoc = L; }
1471 
1472  inline Stmt *getSubStmt();
1473  const Stmt *getSubStmt() const {
1474  return const_cast<SwitchCase *>(this)->getSubStmt();
1475  }
1476 
1477  SourceLocation getBeginLoc() const { return getKeywordLoc(); }
1478  inline SourceLocation getEndLoc() const LLVM_READONLY;
1479 
1480  static bool classof(const Stmt *T) {
1481  return T->getStmtClass() == CaseStmtClass ||
1482  T->getStmtClass() == DefaultStmtClass;
1483  }
1484 };
1485 
1486 /// CaseStmt - Represent a case statement. It can optionally be a GNU case
1487 /// statement of the form LHS ... RHS representing a range of cases.
1488 class CaseStmt final
1489  : public SwitchCase,
1490  private llvm::TrailingObjects<CaseStmt, Stmt *, SourceLocation> {
1491  friend TrailingObjects;
1492 
1493  // CaseStmt is followed by several trailing objects, some of which optional.
1494  // Note that it would be more convenient to put the optional trailing objects
1495  // at the end but this would impact children().
1496  // The trailing objects are in order:
1497  //
1498  // * A "Stmt *" for the LHS of the case statement. Always present.
1499  //
1500  // * A "Stmt *" for the RHS of the case statement. This is a GNU extension
1501  // which allow ranges in cases statement of the form LHS ... RHS.
1502  // Present if and only if caseStmtIsGNURange() is true.
1503  //
1504  // * A "Stmt *" for the substatement of the case statement. Always present.
1505  //
1506  // * A SourceLocation for the location of the ... if this is a case statement
1507  // with a range. Present if and only if caseStmtIsGNURange() is true.
1508  enum { LhsOffset = 0, SubStmtOffsetFromRhs = 1 };
1509  enum { NumMandatoryStmtPtr = 2 };
1510 
1511  unsigned numTrailingObjects(OverloadToken<Stmt *>) const {
1512  return NumMandatoryStmtPtr + caseStmtIsGNURange();
1513  }
1514 
1515  unsigned numTrailingObjects(OverloadToken<SourceLocation>) const {
1516  return caseStmtIsGNURange();
1517  }
1518 
1519  unsigned lhsOffset() const { return LhsOffset; }
1520  unsigned rhsOffset() const { return LhsOffset + caseStmtIsGNURange(); }
1521  unsigned subStmtOffset() const { return rhsOffset() + SubStmtOffsetFromRhs; }
1522 
1523  /// Build a case statement assuming that the storage for the
1524  /// trailing objects has been properly allocated.
1525  CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc,
1526  SourceLocation ellipsisLoc, SourceLocation colonLoc)
1527  : SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
1528  // Handle GNU case statements of the form LHS ... RHS.
1529  bool IsGNURange = rhs != nullptr;
1530  SwitchCaseBits.CaseStmtIsGNURange = IsGNURange;
1531  setLHS(lhs);
1532  setSubStmt(nullptr);
1533  if (IsGNURange) {
1534  setRHS(rhs);
1535  setEllipsisLoc(ellipsisLoc);
1536  }
1537  }
1538 
1539  /// Build an empty switch case statement.
1540  explicit CaseStmt(EmptyShell Empty, bool CaseStmtIsGNURange)
1541  : SwitchCase(CaseStmtClass, Empty) {
1542  SwitchCaseBits.CaseStmtIsGNURange = CaseStmtIsGNURange;
1543  }
1544 
1545 public:
1546  /// Build a case statement.
1547  static CaseStmt *Create(const ASTContext &Ctx, Expr *lhs, Expr *rhs,
1548  SourceLocation caseLoc, SourceLocation ellipsisLoc,
1549  SourceLocation colonLoc);
1550 
1551  /// Build an empty case statement.
1552  static CaseStmt *CreateEmpty(const ASTContext &Ctx, bool CaseStmtIsGNURange);
1553 
1554  /// True if this case statement is of the form case LHS ... RHS, which
1555  /// is a GNU extension. In this case the RHS can be obtained with getRHS()
1556  /// and the location of the ellipsis can be obtained with getEllipsisLoc().
1557  bool caseStmtIsGNURange() const { return SwitchCaseBits.CaseStmtIsGNURange; }
1558 
1559  SourceLocation getCaseLoc() const { return getKeywordLoc(); }
1560  void setCaseLoc(SourceLocation L) { setKeywordLoc(L); }
1561 
1562  /// Get the location of the ... in a case statement of the form LHS ... RHS.
1564  return caseStmtIsGNURange() ? *getTrailingObjects<SourceLocation>()
1565  : SourceLocation();
1566  }
1567 
1568  /// Set the location of the ... in a case statement of the form LHS ... RHS.
1569  /// Assert that this case statement is of this form.
1571  assert(
1572  caseStmtIsGNURange() &&
1573  "setEllipsisLoc but this is not a case stmt of the form LHS ... RHS!");
1574  *getTrailingObjects<SourceLocation>() = L;
1575  }
1576 
1578  return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1579  }
1580 
1581  const Expr *getLHS() const {
1582  return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1583  }
1584 
1585  void setLHS(Expr *Val) {
1586  getTrailingObjects<Stmt *>()[lhsOffset()] = reinterpret_cast<Stmt *>(Val);
1587  }
1588 
1590  return caseStmtIsGNURange() ? reinterpret_cast<Expr *>(
1591  getTrailingObjects<Stmt *>()[rhsOffset()])
1592  : nullptr;
1593  }
1594 
1595  const Expr *getRHS() const {
1596  return caseStmtIsGNURange() ? reinterpret_cast<Expr *>(
1597  getTrailingObjects<Stmt *>()[rhsOffset()])
1598  : nullptr;
1599  }
1600 
1601  void setRHS(Expr *Val) {
1602  assert(caseStmtIsGNURange() &&
1603  "setRHS but this is not a case stmt of the form LHS ... RHS!");
1604  getTrailingObjects<Stmt *>()[rhsOffset()] = reinterpret_cast<Stmt *>(Val);
1605  }
1606 
1607  Stmt *getSubStmt() { return getTrailingObjects<Stmt *>()[subStmtOffset()]; }
1608  const Stmt *getSubStmt() const {
1609  return getTrailingObjects<Stmt *>()[subStmtOffset()];
1610  }
1611 
1612  void setSubStmt(Stmt *S) {
1613  getTrailingObjects<Stmt *>()[subStmtOffset()] = S;
1614  }
1615 
1616  SourceLocation getBeginLoc() const { return getKeywordLoc(); }
1617  SourceLocation getEndLoc() const LLVM_READONLY {
1618  // Handle deeply nested case statements with iteration instead of recursion.
1619  const CaseStmt *CS = this;
1620  while (const auto *CS2 = dyn_cast<CaseStmt>(CS->getSubStmt()))
1621  CS = CS2;
1622 
1623  return CS->getSubStmt()->getEndLoc();
1624  }
1625 
1626  static bool classof(const Stmt *T) {
1627  return T->getStmtClass() == CaseStmtClass;
1628  }
1629 
1630  // Iterators
1632  return child_range(getTrailingObjects<Stmt *>(),
1633  getTrailingObjects<Stmt *>() +
1634  numTrailingObjects(OverloadToken<Stmt *>()));
1635  }
1636 
1638  return const_child_range(getTrailingObjects<Stmt *>(),
1639  getTrailingObjects<Stmt *>() +
1640  numTrailingObjects(OverloadToken<Stmt *>()));
1641  }
1642 };
1643 
1644 class DefaultStmt : public SwitchCase {
1645  Stmt *SubStmt;
1646 
1647 public:
1649  : SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {}
1650 
1651  /// Build an empty default statement.
1652  explicit DefaultStmt(EmptyShell Empty)
1653  : SwitchCase(DefaultStmtClass, Empty) {}
1654 
1655  Stmt *getSubStmt() { return SubStmt; }
1656  const Stmt *getSubStmt() const { return SubStmt; }
1657  void setSubStmt(Stmt *S) { SubStmt = S; }
1658 
1659  SourceLocation getDefaultLoc() const { return getKeywordLoc(); }
1660  void setDefaultLoc(SourceLocation L) { setKeywordLoc(L); }
1661 
1662  SourceLocation getBeginLoc() const { return getKeywordLoc(); }
1663  SourceLocation getEndLoc() const LLVM_READONLY {
1664  return SubStmt->getEndLoc();
1665  }
1666 
1667  static bool classof(const Stmt *T) {
1668  return T->getStmtClass() == DefaultStmtClass;
1669  }
1670 
1671  // Iterators
1672  child_range children() { return child_range(&SubStmt, &SubStmt + 1); }
1673 
1675  return const_child_range(&SubStmt, &SubStmt + 1);
1676  }
1677 };
1678 
1679 SourceLocation SwitchCase::getEndLoc() const {
1680  if (const auto *CS = dyn_cast<CaseStmt>(this))
1681  return CS->getEndLoc();
1682  else if (const auto *DS = dyn_cast<DefaultStmt>(this))
1683  return DS->getEndLoc();
1684  llvm_unreachable("SwitchCase is neither a CaseStmt nor a DefaultStmt!");
1685 }
1686 
1687 Stmt *SwitchCase::getSubStmt() {
1688  if (auto *CS = dyn_cast<CaseStmt>(this))
1689  return CS->getSubStmt();
1690  else if (auto *DS = dyn_cast<DefaultStmt>(this))
1691  return DS->getSubStmt();
1692  llvm_unreachable("SwitchCase is neither a CaseStmt nor a DefaultStmt!");
1693 }
1694 
1695 /// Represents a statement that could possibly have a value and type. This
1696 /// covers expression-statements, as well as labels and attributed statements.
1697 ///
1698 /// Value statements have a special meaning when they are the last non-null
1699 /// statement in a GNU statement expression, where they determine the value
1700 /// of the statement expression.
1701 class ValueStmt : public Stmt {
1702 protected:
1703  using Stmt::Stmt;
1704 
1705 public:
1706  const Expr *getExprStmt() const;
1708  const ValueStmt *ConstThis = this;
1709  return const_cast<Expr*>(ConstThis->getExprStmt());
1710  }
1711 
1712  static bool classof(const Stmt *T) {
1713  return T->getStmtClass() >= firstValueStmtConstant &&
1714  T->getStmtClass() <= lastValueStmtConstant;
1715  }
1716 };
1717 
1718 /// LabelStmt - Represents a label, which has a substatement. For example:
1719 /// foo: return;
1720 class LabelStmt : public ValueStmt {
1721  LabelDecl *TheDecl;
1722  Stmt *SubStmt;
1723 
1724 public:
1725  /// Build a label statement.
1727  : ValueStmt(LabelStmtClass), TheDecl(D), SubStmt(substmt) {
1728  setIdentLoc(IL);
1729  }
1730 
1731  /// Build an empty label statement.
1732  explicit LabelStmt(EmptyShell Empty) : ValueStmt(LabelStmtClass, Empty) {}
1733 
1734  SourceLocation getIdentLoc() const { return LabelStmtBits.IdentLoc; }
1735  void setIdentLoc(SourceLocation L) { LabelStmtBits.IdentLoc = L; }
1736 
1737  LabelDecl *getDecl() const { return TheDecl; }
1738  void setDecl(LabelDecl *D) { TheDecl = D; }
1739 
1740  const char *getName() const;
1741  Stmt *getSubStmt() { return SubStmt; }
1742 
1743  const Stmt *getSubStmt() const { return SubStmt; }
1744  void setSubStmt(Stmt *SS) { SubStmt = SS; }
1745 
1746  SourceLocation getBeginLoc() const { return getIdentLoc(); }
1747  SourceLocation getEndLoc() const LLVM_READONLY { return SubStmt->getEndLoc();}
1748 
1749  child_range children() { return child_range(&SubStmt, &SubStmt + 1); }
1750 
1752  return const_child_range(&SubStmt, &SubStmt + 1);
1753  }
1754 
1755  static bool classof(const Stmt *T) {
1756  return T->getStmtClass() == LabelStmtClass;
1757  }
1758 };
1759 
1760 /// Represents an attribute applied to a statement.
1761 ///
1762 /// Represents an attribute applied to a statement. For example:
1763 /// [[omp::for(...)]] for (...) { ... }
1764 class AttributedStmt final
1765  : public ValueStmt,
1766  private llvm::TrailingObjects<AttributedStmt, const Attr *> {
1767  friend class ASTStmtReader;
1768  friend TrailingObjects;
1769 
1770  Stmt *SubStmt;
1771 
1773  Stmt *SubStmt)
1774  : ValueStmt(AttributedStmtClass), SubStmt(SubStmt) {
1775  AttributedStmtBits.NumAttrs = Attrs.size();
1776  AttributedStmtBits.AttrLoc = Loc;
1777  std::copy(Attrs.begin(), Attrs.end(), getAttrArrayPtr());
1778  }
1779 
1780  explicit AttributedStmt(EmptyShell Empty, unsigned NumAttrs)
1781  : ValueStmt(AttributedStmtClass, Empty) {
1782  AttributedStmtBits.NumAttrs = NumAttrs;
1783  AttributedStmtBits.AttrLoc = SourceLocation{};
1784  std::fill_n(getAttrArrayPtr(), NumAttrs, nullptr);
1785  }
1786 
1787  const Attr *const *getAttrArrayPtr() const {
1788  return getTrailingObjects<const Attr *>();
1789  }
1790  const Attr **getAttrArrayPtr() { return getTrailingObjects<const Attr *>(); }
1791 
1792 public:
1793  static AttributedStmt *Create(const ASTContext &C, SourceLocation Loc,
1794  ArrayRef<const Attr *> Attrs, Stmt *SubStmt);
1795 
1796  // Build an empty attributed statement.
1797  static AttributedStmt *CreateEmpty(const ASTContext &C, unsigned NumAttrs);
1798 
1799  SourceLocation getAttrLoc() const { return AttributedStmtBits.AttrLoc; }
1801  return llvm::makeArrayRef(getAttrArrayPtr(), AttributedStmtBits.NumAttrs);
1802  }
1803 
1804  Stmt *getSubStmt() { return SubStmt; }
1805  const Stmt *getSubStmt() const { return SubStmt; }
1806 
1807  SourceLocation getBeginLoc() const { return getAttrLoc(); }
1808  SourceLocation getEndLoc() const LLVM_READONLY { return SubStmt->getEndLoc();}
1809 
1810  child_range children() { return child_range(&SubStmt, &SubStmt + 1); }
1811 
1813  return const_child_range(&SubStmt, &SubStmt + 1);
1814  }
1815 
1816  static bool classof(const Stmt *T) {
1817  return T->getStmtClass() == AttributedStmtClass;
1818  }
1819 };
1820 
1821 /// IfStmt - This represents an if/then/else.
1822 class IfStmt final
1823  : public Stmt,
1824  private llvm::TrailingObjects<IfStmt, Stmt *, SourceLocation> {
1825  friend TrailingObjects;
1826 
1827  // IfStmt is followed by several trailing objects, some of which optional.
1828  // Note that it would be more convenient to put the optional trailing
1829  // objects at then end but this would change the order of the children.
1830  // The trailing objects are in order:
1831  //
1832  // * A "Stmt *" for the init statement.
1833  // Present if and only if hasInitStorage().
1834  //
1835  // * A "Stmt *" for the condition variable.
1836  // Present if and only if hasVarStorage(). This is in fact a "DeclStmt *".
1837  //
1838  // * A "Stmt *" for the condition.
1839  // Always present. This is in fact a "Expr *".
1840  //
1841  // * A "Stmt *" for the then statement.
1842  // Always present.
1843  //
1844  // * A "Stmt *" for the else statement.
1845  // Present if and only if hasElseStorage().
1846  //
1847  // * A "SourceLocation" for the location of the "else".
1848  // Present if and only if hasElseStorage().
1849  enum { InitOffset = 0, ThenOffsetFromCond = 1, ElseOffsetFromCond = 2 };
1850  enum { NumMandatoryStmtPtr = 2 };
1851 
1852  unsigned numTrailingObjects(OverloadToken<Stmt *>) const {
1853  return NumMandatoryStmtPtr + hasElseStorage() + hasVarStorage() +
1854  hasInitStorage();
1855  }
1856 
1857  unsigned numTrailingObjects(OverloadToken<SourceLocation>) const {
1858  return hasElseStorage();
1859  }
1860 
1861  unsigned initOffset() const { return InitOffset; }
1862  unsigned varOffset() const { return InitOffset + hasInitStorage(); }
1863  unsigned condOffset() const {
1864  return InitOffset + hasInitStorage() + hasVarStorage();
1865  }
1866  unsigned thenOffset() const { return condOffset() + ThenOffsetFromCond; }
1867  unsigned elseOffset() const { return condOffset() + ElseOffsetFromCond; }
1868 
1869  /// Build an if/then/else statement.
1870  IfStmt(const ASTContext &Ctx, SourceLocation IL, bool IsConstexpr, Stmt *Init,
1871  VarDecl *Var, Expr *Cond, Stmt *Then, SourceLocation EL, Stmt *Else);
1872 
1873  /// Build an empty if/then/else statement.
1874  explicit IfStmt(EmptyShell Empty, bool HasElse, bool HasVar, bool HasInit);
1875 
1876 public:
1877  /// Create an IfStmt.
1878  static IfStmt *Create(const ASTContext &Ctx, SourceLocation IL,
1879  bool IsConstexpr, Stmt *Init, VarDecl *Var, Expr *Cond,
1880  Stmt *Then, SourceLocation EL = SourceLocation(),
1881  Stmt *Else = nullptr);
1882 
1883  /// Create an empty IfStmt optionally with storage for an else statement,
1884  /// condition variable and init expression.
1885  static IfStmt *CreateEmpty(const ASTContext &Ctx, bool HasElse, bool HasVar,
1886  bool HasInit);
1887 
1888  /// True if this IfStmt has the storage for an init statement.
1889  bool hasInitStorage() const { return IfStmtBits.HasInit; }
1890 
1891  /// True if this IfStmt has storage for a variable declaration.
1892  bool hasVarStorage() const { return IfStmtBits.HasVar; }
1893 
1894  /// True if this IfStmt has storage for an else statement.
1895  bool hasElseStorage() const { return IfStmtBits.HasElse; }
1896 
1898  return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
1899  }
1900 
1901  const Expr *getCond() const {
1902  return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
1903  }
1904 
1905  void setCond(Expr *Cond) {
1906  getTrailingObjects<Stmt *>()[condOffset()] = reinterpret_cast<Stmt *>(Cond);
1907  }
1908 
1909  Stmt *getThen() { return getTrailingObjects<Stmt *>()[thenOffset()]; }
1910  const Stmt *getThen() const {
1911  return getTrailingObjects<Stmt *>()[thenOffset()];
1912  }
1913 
1914  void setThen(Stmt *Then) {
1915  getTrailingObjects<Stmt *>()[thenOffset()] = Then;
1916  }
1917 
1919  return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
1920  : nullptr;
1921  }
1922 
1923  const Stmt *getElse() const {
1924  return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
1925  : nullptr;
1926  }
1927 
1928  void setElse(Stmt *Else) {
1929  assert(hasElseStorage() &&
1930  "This if statement has no storage for an else statement!");
1931  getTrailingObjects<Stmt *>()[elseOffset()] = Else;
1932  }
1933 
1934  /// Retrieve the variable declared in this "if" statement, if any.
1935  ///
1936  /// In the following example, "x" is the condition variable.
1937  /// \code
1938  /// if (int x = foo()) {
1939  /// printf("x is %d", x);
1940  /// }
1941  /// \endcode
1942  VarDecl *getConditionVariable();
1944  return const_cast<IfStmt *>(this)->getConditionVariable();
1945  }
1946 
1947  /// Set the condition variable for this if statement.
1948  /// The if statement must have storage for the condition variable.
1949  void setConditionVariable(const ASTContext &Ctx, VarDecl *V);
1950 
1951  /// If this IfStmt has a condition variable, return the faux DeclStmt
1952  /// associated with the creation of that condition variable.
1954  return hasVarStorage() ? static_cast<DeclStmt *>(
1955  getTrailingObjects<Stmt *>()[varOffset()])
1956  : nullptr;
1957  }
1958 
1960  return hasVarStorage() ? static_cast<DeclStmt *>(
1961  getTrailingObjects<Stmt *>()[varOffset()])
1962  : nullptr;
1963  }
1964 
1966  return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
1967  : nullptr;
1968  }
1969 
1970  const Stmt *getInit() const {
1971  return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
1972  : nullptr;
1973  }
1974 
1975  void setInit(Stmt *Init) {
1976  assert(hasInitStorage() &&
1977  "This if statement has no storage for an init statement!");
1978  getTrailingObjects<Stmt *>()[initOffset()] = Init;
1979  }
1980 
1981  SourceLocation getIfLoc() const { return IfStmtBits.IfLoc; }
1982  void setIfLoc(SourceLocation IfLoc) { IfStmtBits.IfLoc = IfLoc; }
1983 
1985  return hasElseStorage() ? *getTrailingObjects<SourceLocation>()
1986  : SourceLocation();
1987  }
1988 
1989  void setElseLoc(SourceLocation ElseLoc) {
1990  assert(hasElseStorage() &&
1991  "This if statement has no storage for an else statement!");
1992  *getTrailingObjects<SourceLocation>() = ElseLoc;
1993  }
1994 
1995  bool isConstexpr() const { return IfStmtBits.IsConstexpr; }
1996  void setConstexpr(bool C) { IfStmtBits.IsConstexpr = C; }
1997 
1998  bool isObjCAvailabilityCheck() const;
1999 
2000  SourceLocation getBeginLoc() const { return getIfLoc(); }
2001  SourceLocation getEndLoc() const LLVM_READONLY {
2002  if (getElse())
2003  return getElse()->getEndLoc();
2004  return getThen()->getEndLoc();
2005  }
2006 
2007  // Iterators over subexpressions. The iterators will include iterating
2008  // over the initialization expression referenced by the condition variable.
2010  return child_range(getTrailingObjects<Stmt *>(),
2011  getTrailingObjects<Stmt *>() +
2012  numTrailingObjects(OverloadToken<Stmt *>()));
2013  }
2014 
2016  return const_child_range(getTrailingObjects<Stmt *>(),
2017  getTrailingObjects<Stmt *>() +
2018  numTrailingObjects(OverloadToken<Stmt *>()));
2019  }
2020 
2021  static bool classof(const Stmt *T) {
2022  return T->getStmtClass() == IfStmtClass;
2023  }
2024 };
2025 
2026 /// SwitchStmt - This represents a 'switch' stmt.
2027 class SwitchStmt final : public Stmt,
2028  private llvm::TrailingObjects<SwitchStmt, Stmt *> {
2029  friend TrailingObjects;
2030 
2031  /// Points to a linked list of case and default statements.
2032  SwitchCase *FirstCase;
2033 
2034  // SwitchStmt is followed by several trailing objects,
2035  // some of which optional. Note that it would be more convenient to
2036  // put the optional trailing objects at the end but this would change
2037  // the order in children().
2038  // The trailing objects are in order:
2039  //
2040  // * A "Stmt *" for the init statement.
2041  // Present if and only if hasInitStorage().
2042  //
2043  // * A "Stmt *" for the condition variable.
2044  // Present if and only if hasVarStorage(). This is in fact a "DeclStmt *".
2045  //
2046  // * A "Stmt *" for the condition.
2047  // Always present. This is in fact an "Expr *".
2048  //
2049  // * A "Stmt *" for the body.
2050  // Always present.
2051  enum { InitOffset = 0, BodyOffsetFromCond = 1 };
2052  enum { NumMandatoryStmtPtr = 2 };
2053 
2054  unsigned numTrailingObjects(OverloadToken<Stmt *>) const {
2055  return NumMandatoryStmtPtr + hasInitStorage() + hasVarStorage();
2056  }
2057 
2058  unsigned initOffset() const { return InitOffset; }
2059  unsigned varOffset() const { return InitOffset + hasInitStorage(); }
2060  unsigned condOffset() const {
2061  return InitOffset + hasInitStorage() + hasVarStorage();
2062  }
2063  unsigned bodyOffset() const { return condOffset() + BodyOffsetFromCond; }
2064 
2065  /// Build a switch statement.
2066  SwitchStmt(const ASTContext &Ctx, Stmt *Init, VarDecl *Var, Expr *Cond);
2067 
2068  /// Build a empty switch statement.
2069  explicit SwitchStmt(EmptyShell Empty, bool HasInit, bool HasVar);
2070 
2071 public:
2072  /// Create a switch statement.
2073  static SwitchStmt *Create(const ASTContext &Ctx, Stmt *Init, VarDecl *Var,
2074  Expr *Cond);
2075 
2076  /// Create an empty switch statement optionally with storage for
2077  /// an init expression and a condition variable.
2078  static SwitchStmt *CreateEmpty(const ASTContext &Ctx, bool HasInit,
2079  bool HasVar);
2080 
2081  /// True if this SwitchStmt has storage for an init statement.
2082  bool hasInitStorage() const { return SwitchStmtBits.HasInit; }
2083 
2084  /// True if this SwitchStmt has storage for a condition variable.
2085  bool hasVarStorage() const { return SwitchStmtBits.HasVar; }
2086 
2088  return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
2089  }
2090 
2091  const Expr *getCond() const {
2092  return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
2093  }
2094 
2095  void setCond(Expr *Cond) {
2096  getTrailingObjects<Stmt *>()[condOffset()] = reinterpret_cast<Stmt *>(Cond);
2097  }
2098 
2099  Stmt *getBody() { return getTrailingObjects<Stmt *>()[bodyOffset()]; }
2100  const Stmt *getBody() const {
2101  return getTrailingObjects<Stmt *>()[bodyOffset()];
2102  }
2103 
2104  void setBody(Stmt *Body) {
2105  getTrailingObjects<Stmt *>()[bodyOffset()] = Body;
2106  }
2107 
2109  return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2110  : nullptr;
2111  }
2112 
2113  const Stmt *getInit() const {
2114  return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2115  : nullptr;
2116  }
2117 
2118  void setInit(Stmt *Init) {
2119  assert(hasInitStorage() &&
2120  "This switch statement has no storage for an init statement!");
2121  getTrailingObjects<Stmt *>()[initOffset()] = Init;
2122  }
2123 
2124  /// Retrieve the variable declared in this "switch" statement, if any.
2125  ///
2126  /// In the following example, "x" is the condition variable.
2127  /// \code
2128  /// switch (int x = foo()) {
2129  /// case 0: break;
2130  /// // ...
2131  /// }
2132  /// \endcode
2133  VarDecl *getConditionVariable();
2135  return const_cast<SwitchStmt *>(this)->getConditionVariable();
2136  }
2137 
2138  /// Set the condition variable in this switch statement.
2139  /// The switch statement must have storage for it.
2140  void setConditionVariable(const ASTContext &Ctx, VarDecl *VD);
2141 
2142  /// If this SwitchStmt has a condition variable, return the faux DeclStmt
2143  /// associated with the creation of that condition variable.
2145  return hasVarStorage() ? static_cast<DeclStmt *>(
2146  getTrailingObjects<Stmt *>()[varOffset()])
2147  : nullptr;
2148  }
2149 
2151  return hasVarStorage() ? static_cast<DeclStmt *>(
2152  getTrailingObjects<Stmt *>()[varOffset()])
2153  : nullptr;
2154  }
2155 
2156  SwitchCase *getSwitchCaseList() { return FirstCase; }
2157  const SwitchCase *getSwitchCaseList() const { return FirstCase; }
2158  void setSwitchCaseList(SwitchCase *SC) { FirstCase = SC; }
2159 
2160  SourceLocation getSwitchLoc() const { return SwitchStmtBits.SwitchLoc; }
2161  void setSwitchLoc(SourceLocation L) { SwitchStmtBits.SwitchLoc = L; }
2162 
2163  void setBody(Stmt *S, SourceLocation SL) {
2164  setBody(S);
2165  setSwitchLoc(SL);
2166  }
2167 
2169  assert(!SC->getNextSwitchCase() &&
2170  "case/default already added to a switch");
2171  SC->setNextSwitchCase(FirstCase);
2172  FirstCase = SC;
2173  }
2174 
2175  /// Set a flag in the SwitchStmt indicating that if the 'switch (X)' is a
2176  /// switch over an enum value then all cases have been explicitly covered.
2177  void setAllEnumCasesCovered() { SwitchStmtBits.AllEnumCasesCovered = true; }
2178 
2179  /// Returns true if the SwitchStmt is a switch of an enum value and all cases
2180  /// have been explicitly covered.
2181  bool isAllEnumCasesCovered() const {
2182  return SwitchStmtBits.AllEnumCasesCovered;
2183  }
2184 
2185  SourceLocation getBeginLoc() const { return getSwitchLoc(); }
2186  SourceLocation getEndLoc() const LLVM_READONLY {
2187  return getBody() ? getBody()->getEndLoc()
2188  : reinterpret_cast<const Stmt *>(getCond())->getEndLoc();
2189  }
2190 
2191  // Iterators
2193  return child_range(getTrailingObjects<Stmt *>(),
2194  getTrailingObjects<Stmt *>() +
2195  numTrailingObjects(OverloadToken<Stmt *>()));
2196  }
2197 
2199  return const_child_range(getTrailingObjects<Stmt *>(),
2200  getTrailingObjects<Stmt *>() +
2201  numTrailingObjects(OverloadToken<Stmt *>()));
2202  }
2203 
2204  static bool classof(const Stmt *T) {
2205  return T->getStmtClass() == SwitchStmtClass;
2206  }
2207 };
2208 
2209 /// WhileStmt - This represents a 'while' stmt.
2210 class WhileStmt final : public Stmt,
2211  private llvm::TrailingObjects<WhileStmt, Stmt *> {
2212  friend TrailingObjects;
2213 
2214  // WhileStmt is followed by several trailing objects,
2215  // some of which optional. Note that it would be more
2216  // convenient to put the optional trailing object at the end
2217  // but this would affect children().
2218  // The trailing objects are in order:
2219  //
2220  // * A "Stmt *" for the condition variable.
2221  // Present if and only if hasVarStorage(). This is in fact a "DeclStmt *".
2222  //
2223  // * A "Stmt *" for the condition.
2224  // Always present. This is in fact an "Expr *".
2225  //
2226  // * A "Stmt *" for the body.
2227  // Always present.
2228  //
2229  enum { VarOffset = 0, BodyOffsetFromCond = 1 };
2230  enum { NumMandatoryStmtPtr = 2 };
2231 
2232  unsigned varOffset() const { return VarOffset; }
2233  unsigned condOffset() const { return VarOffset + hasVarStorage(); }
2234  unsigned bodyOffset() const { return condOffset() + BodyOffsetFromCond; }
2235 
2236  unsigned numTrailingObjects(OverloadToken<Stmt *>) const {
2237  return NumMandatoryStmtPtr + hasVarStorage();
2238  }
2239 
2240  /// Build a while statement.
2241  WhileStmt(const ASTContext &Ctx, VarDecl *Var, Expr *Cond, Stmt *Body,
2242  SourceLocation WL);
2243 
2244  /// Build an empty while statement.
2245  explicit WhileStmt(EmptyShell Empty, bool HasVar);
2246 
2247 public:
2248  /// Create a while statement.
2249  static WhileStmt *Create(const ASTContext &Ctx, VarDecl *Var, Expr *Cond,
2250  Stmt *Body, SourceLocation WL);
2251 
2252  /// Create an empty while statement optionally with storage for
2253  /// a condition variable.
2254  static WhileStmt *CreateEmpty(const ASTContext &Ctx, bool HasVar);
2255 
2256  /// True if this WhileStmt has storage for a condition variable.
2257  bool hasVarStorage() const { return WhileStmtBits.HasVar; }
2258 
2260  return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
2261  }
2262 
2263  const Expr *getCond() const {
2264  return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
2265  }
2266 
2267  void setCond(Expr *Cond) {
2268  getTrailingObjects<Stmt *>()[condOffset()] = reinterpret_cast<Stmt *>(Cond);
2269  }
2270 
2271  Stmt *getBody() { return getTrailingObjects<Stmt *>()[bodyOffset()]; }
2272  const Stmt *getBody() const {
2273  return getTrailingObjects<Stmt *>()[bodyOffset()];
2274  }
2275 
2276  void setBody(Stmt *Body) {
2277  getTrailingObjects<Stmt *>()[bodyOffset()] = Body;
2278  }
2279 
2280  /// Retrieve the variable declared in this "while" statement, if any.
2281  ///
2282  /// In the following example, "x" is the condition variable.
2283  /// \code
2284  /// while (int x = random()) {
2285  /// // ...
2286  /// }
2287  /// \endcode
2288  VarDecl *getConditionVariable();
2290  return const_cast<WhileStmt *>(this)->getConditionVariable();
2291  }
2292 
2293  /// Set the condition variable of this while statement.
2294  /// The while statement must have storage for it.
2295  void setConditionVariable(const ASTContext &Ctx, VarDecl *V);
2296 
2297  /// If this WhileStmt has a condition variable, return the faux DeclStmt
2298  /// associated with the creation of that condition variable.
2300  return hasVarStorage() ? static_cast<DeclStmt *>(
2301  getTrailingObjects<Stmt *>()[varOffset()])
2302  : nullptr;
2303  }
2304 
2306  return hasVarStorage() ? static_cast<DeclStmt *>(
2307  getTrailingObjects<Stmt *>()[varOffset()])
2308  : nullptr;
2309  }
2310 
2311  SourceLocation getWhileLoc() const { return WhileStmtBits.WhileLoc; }
2312  void setWhileLoc(SourceLocation L) { WhileStmtBits.WhileLoc = L; }
2313 
2314  SourceLocation getBeginLoc() const { return getWhileLoc(); }
2315  SourceLocation getEndLoc() const LLVM_READONLY {
2316  return getBody()->getEndLoc();
2317  }
2318 
2319  static bool classof(const Stmt *T) {
2320  return T->getStmtClass() == WhileStmtClass;
2321  }
2322 
2323  // Iterators
2325  return child_range(getTrailingObjects<Stmt *>(),
2326  getTrailingObjects<Stmt *>() +
2327  numTrailingObjects(OverloadToken<Stmt *>()));
2328  }
2329 
2331  return const_child_range(getTrailingObjects<Stmt *>(),
2332  getTrailingObjects<Stmt *>() +
2333  numTrailingObjects(OverloadToken<Stmt *>()));
2334  }
2335 };
2336 
2337 /// DoStmt - This represents a 'do/while' stmt.
2338 class DoStmt : public Stmt {
2339  enum { BODY, COND, END_EXPR };
2340  Stmt *SubExprs[END_EXPR];
2341  SourceLocation WhileLoc;
2342  SourceLocation RParenLoc; // Location of final ')' in do stmt condition.
2343 
2344 public:
2346  SourceLocation RP)
2347  : Stmt(DoStmtClass), WhileLoc(WL), RParenLoc(RP) {
2348  setCond(Cond);
2349  setBody(Body);
2350  setDoLoc(DL);
2351  }
2352 
2353  /// Build an empty do-while statement.
2354  explicit DoStmt(EmptyShell Empty) : Stmt(DoStmtClass, Empty) {}
2355 
2356  Expr *getCond() { return reinterpret_cast<Expr *>(SubExprs[COND]); }
2357  const Expr *getCond() const {
2358  return reinterpret_cast<Expr *>(SubExprs[COND]);
2359  }
2360 
2361  void setCond(Expr *Cond) { SubExprs[COND] = reinterpret_cast<Stmt *>(Cond); }
2362 
2363  Stmt *getBody() { return SubExprs[BODY]; }
2364  const Stmt *getBody() const { return SubExprs[BODY]; }
2365  void setBody(Stmt *Body) { SubExprs[BODY] = Body; }
2366 
2367  SourceLocation getDoLoc() const { return DoStmtBits.DoLoc; }
2368  void setDoLoc(SourceLocation L) { DoStmtBits.DoLoc = L; }
2369  SourceLocation getWhileLoc() const { return WhileLoc; }
2370  void setWhileLoc(SourceLocation L) { WhileLoc = L; }
2371  SourceLocation getRParenLoc() const { return RParenLoc; }
2372  void setRParenLoc(SourceLocation L) { RParenLoc = L; }
2373 
2374  SourceLocation getBeginLoc() const { return getDoLoc(); }
2375  SourceLocation getEndLoc() const { return getRParenLoc(); }
2376 
2377  static bool classof(const Stmt *T) {
2378  return T->getStmtClass() == DoStmtClass;
2379  }
2380 
2381  // Iterators
2383  return child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2384  }
2385 
2387  return const_child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2388  }
2389 };
2390 
2391 /// ForStmt - This represents a 'for (init;cond;inc)' stmt. Note that any of
2392 /// the init/cond/inc parts of the ForStmt will be null if they were not
2393 /// specified in the source.
2394 class ForStmt : public Stmt {
2395  enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
2396  Stmt* SubExprs[END_EXPR]; // SubExprs[INIT] is an expression or declstmt.
2397  SourceLocation LParenLoc, RParenLoc;
2398 
2399 public:
2400  ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar,
2401  Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP,
2402  SourceLocation RP);
2403 
2404  /// Build an empty for statement.
2405  explicit ForStmt(EmptyShell Empty) : Stmt(ForStmtClass, Empty) {}
2406 
2407  Stmt *getInit() { return SubExprs[INIT]; }
2408 
2409  /// Retrieve the variable declared in this "for" statement, if any.
2410  ///
2411  /// In the following example, "y" is the condition variable.
2412  /// \code
2413  /// for (int x = random(); int y = mangle(x); ++x) {
2414  /// // ...
2415  /// }
2416  /// \endcode
2417  VarDecl *getConditionVariable() const;
2418  void setConditionVariable(const ASTContext &C, VarDecl *V);
2419 
2420  /// If this ForStmt has a condition variable, return the faux DeclStmt
2421  /// associated with the creation of that condition variable.
2423  return reinterpret_cast<DeclStmt*>(SubExprs[CONDVAR]);
2424  }
2425 
2426  Expr *getCond() { return reinterpret_cast<Expr*>(SubExprs[COND]); }
2427  Expr *getInc() { return reinterpret_cast<Expr*>(SubExprs[INC]); }
2428  Stmt *getBody() { return SubExprs[BODY]; }
2429 
2430  const Stmt *getInit() const { return SubExprs[INIT]; }
2431  const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
2432  const Expr *getInc() const { return reinterpret_cast<Expr*>(SubExprs[INC]); }
2433  const Stmt *getBody() const { return SubExprs[BODY]; }
2434 
2435  void setInit(Stmt *S) { SubExprs[INIT] = S; }
2436  void setCond(Expr *E) { SubExprs[COND] = reinterpret_cast<Stmt*>(E); }
2437  void setInc(Expr *E) { SubExprs[INC] = reinterpret_cast<Stmt*>(E); }
2438  void setBody(Stmt *S) { SubExprs[BODY] = S; }
2439 
2440  SourceLocation getForLoc() const { return ForStmtBits.ForLoc; }
2441  void setForLoc(SourceLocation L) { ForStmtBits.ForLoc = L; }
2442  SourceLocation getLParenLoc() const { return LParenLoc; }
2443  void setLParenLoc(SourceLocation L) { LParenLoc = L; }
2444  SourceLocation getRParenLoc() const { return RParenLoc; }
2445  void setRParenLoc(SourceLocation L) { RParenLoc = L; }
2446 
2447  SourceLocation getBeginLoc() const { return getForLoc(); }
2448  SourceLocation getEndLoc() const { return getBody()->getEndLoc(); }
2449 
2450  static bool classof(const Stmt *T) {
2451  return T->getStmtClass() == ForStmtClass;
2452  }
2453 
2454  // Iterators
2456  return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2457  }
2458 
2460  return const_child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2461  }
2462 };
2463 
2464 /// GotoStmt - This represents a direct goto.
2465 class GotoStmt : public Stmt {
2466  LabelDecl *Label;
2467  SourceLocation LabelLoc;
2468 
2469 public:
2471  : Stmt(GotoStmtClass), Label(label), LabelLoc(LL) {
2472  setGotoLoc(GL);
2473  }
2474 
2475  /// Build an empty goto statement.
2476  explicit GotoStmt(EmptyShell Empty) : Stmt(GotoStmtClass, Empty) {}
2477 
2478  LabelDecl *getLabel() const { return Label; }
2479  void setLabel(LabelDecl *D) { Label = D; }
2480 
2481  SourceLocation getGotoLoc() const { return GotoStmtBits.GotoLoc; }
2482  void setGotoLoc(SourceLocation L) { GotoStmtBits.GotoLoc = L; }
2483  SourceLocation getLabelLoc() const { return LabelLoc; }
2484  void setLabelLoc(SourceLocation L) { LabelLoc = L; }
2485 
2486  SourceLocation getBeginLoc() const { return getGotoLoc(); }
2487  SourceLocation getEndLoc() const { return getLabelLoc(); }
2488 
2489  static bool classof(const Stmt *T) {
2490  return T->getStmtClass() == GotoStmtClass;
2491  }
2492 
2493  // Iterators
2496  }
2497 
2500  }
2501 };
2502 
2503 /// IndirectGotoStmt - This represents an indirect goto.
2504 class IndirectGotoStmt : public Stmt {
2505  SourceLocation StarLoc;
2506  Stmt *Target;
2507 
2508 public:
2510  : Stmt(IndirectGotoStmtClass), StarLoc(starLoc) {
2511  setTarget(target);
2512  setGotoLoc(gotoLoc);
2513  }
2514 
2515  /// Build an empty indirect goto statement.
2517  : Stmt(IndirectGotoStmtClass, Empty) {}
2518 
2519  void setGotoLoc(SourceLocation L) { GotoStmtBits.GotoLoc = L; }
2520  SourceLocation getGotoLoc() const { return GotoStmtBits.GotoLoc; }
2521  void setStarLoc(SourceLocation L) { StarLoc = L; }
2522  SourceLocation getStarLoc() const { return StarLoc; }
2523 
2524  Expr *getTarget() { return reinterpret_cast<Expr *>(Target); }
2525  const Expr *getTarget() const {
2526  return reinterpret_cast<const Expr *>(Target);
2527  }
2528  void setTarget(Expr *E) { Target = reinterpret_cast<Stmt *>(E); }
2529 
2530  /// getConstantTarget - Returns the fixed target of this indirect
2531  /// goto, if one exists.
2532  LabelDecl *getConstantTarget();
2533  const LabelDecl *getConstantTarget() const {
2534  return const_cast<IndirectGotoStmt *>(this)->getConstantTarget();
2535  }
2536 
2537  SourceLocation getBeginLoc() const { return getGotoLoc(); }
2538  SourceLocation getEndLoc() const LLVM_READONLY { return Target->getEndLoc(); }
2539 
2540  static bool classof(const Stmt *T) {
2541  return T->getStmtClass() == IndirectGotoStmtClass;
2542  }
2543 
2544  // Iterators
2545  child_range children() { return child_range(&Target, &Target + 1); }
2546 
2548  return const_child_range(&Target, &Target + 1);
2549  }
2550 };
2551 
2552 /// ContinueStmt - This represents a continue.
2553 class ContinueStmt : public Stmt {
2554 public:
2555  ContinueStmt(SourceLocation CL) : Stmt(ContinueStmtClass) {
2556  setContinueLoc(CL);
2557  }
2558 
2559  /// Build an empty continue statement.
2560  explicit ContinueStmt(EmptyShell Empty) : Stmt(ContinueStmtClass, Empty) {}
2561 
2562  SourceLocation getContinueLoc() const { return ContinueStmtBits.ContinueLoc; }
2563  void setContinueLoc(SourceLocation L) { ContinueStmtBits.ContinueLoc = L; }
2564 
2565  SourceLocation getBeginLoc() const { return getContinueLoc(); }
2566  SourceLocation getEndLoc() const { return getContinueLoc(); }
2567 
2568  static bool classof(const Stmt *T) {
2569  return T->getStmtClass() == ContinueStmtClass;
2570  }
2571 
2572  // Iterators
2575  }
2576 
2579  }
2580 };
2581 
2582 /// BreakStmt - This represents a break.
2583 class BreakStmt : public Stmt {
2584 public:
2585  BreakStmt(SourceLocation BL) : Stmt(BreakStmtClass) {
2586  setBreakLoc(BL);
2587  }
2588 
2589  /// Build an empty break statement.
2590  explicit BreakStmt(EmptyShell Empty) : Stmt(BreakStmtClass, Empty) {}
2591 
2592  SourceLocation getBreakLoc() const { return BreakStmtBits.BreakLoc; }
2593  void setBreakLoc(SourceLocation L) { BreakStmtBits.BreakLoc = L; }
2594 
2595  SourceLocation getBeginLoc() const { return getBreakLoc(); }
2596  SourceLocation getEndLoc() const { return getBreakLoc(); }
2597 
2598  static bool classof(const Stmt *T) {
2599  return T->getStmtClass() == BreakStmtClass;
2600  }
2601 
2602  // Iterators
2605  }
2606 
2609  }
2610 };
2611 
2612 /// ReturnStmt - This represents a return, optionally of an expression:
2613 /// return;
2614 /// return 4;
2615 ///
2616 /// Note that GCC allows return with no argument in a function declared to
2617 /// return a value, and it allows returning a value in functions declared to
2618 /// return void. We explicitly model this in the AST, which means you can't
2619 /// depend on the return type of the function and the presence of an argument.
2620 class ReturnStmt final
2621  : public Stmt,
2622  private llvm::TrailingObjects<ReturnStmt, const VarDecl *> {
2623  friend TrailingObjects;
2624 
2625  /// The return expression.
2626  Stmt *RetExpr;
2627 
2628  // ReturnStmt is followed optionally by a trailing "const VarDecl *"
2629  // for the NRVO candidate. Present if and only if hasNRVOCandidate().
2630 
2631  /// True if this ReturnStmt has storage for an NRVO candidate.
2632  bool hasNRVOCandidate() const { return ReturnStmtBits.HasNRVOCandidate; }
2633 
2634  unsigned numTrailingObjects(OverloadToken<const VarDecl *>) const {
2635  return hasNRVOCandidate();
2636  }
2637 
2638  /// Build a return statement.
2639  ReturnStmt(SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate);
2640 
2641  /// Build an empty return statement.
2642  explicit ReturnStmt(EmptyShell Empty, bool HasNRVOCandidate);
2643 
2644 public:
2645  /// Create a return statement.
2646  static ReturnStmt *Create(const ASTContext &Ctx, SourceLocation RL, Expr *E,
2647  const VarDecl *NRVOCandidate);
2648 
2649  /// Create an empty return statement, optionally with
2650  /// storage for an NRVO candidate.
2651  static ReturnStmt *CreateEmpty(const ASTContext &Ctx, bool HasNRVOCandidate);
2652 
2653  Expr *getRetValue() { return reinterpret_cast<Expr *>(RetExpr); }
2654  const Expr *getRetValue() const { return reinterpret_cast<Expr *>(RetExpr); }
2655  void setRetValue(Expr *E) { RetExpr = reinterpret_cast<Stmt *>(E); }
2656 
2657  /// Retrieve the variable that might be used for the named return
2658  /// value optimization.
2659  ///
2660  /// The optimization itself can only be performed if the variable is
2661  /// also marked as an NRVO object.
2662  const VarDecl *getNRVOCandidate() const {
2663  return hasNRVOCandidate() ? *getTrailingObjects<const VarDecl *>()
2664  : nullptr;
2665  }
2666 
2667  /// Set the variable that might be used for the named return value
2668  /// optimization. The return statement must have storage for it,
2669  /// which is the case if and only if hasNRVOCandidate() is true.
2670  void setNRVOCandidate(const VarDecl *Var) {
2671  assert(hasNRVOCandidate() &&
2672  "This return statement has no storage for an NRVO candidate!");
2673  *getTrailingObjects<const VarDecl *>() = Var;
2674  }
2675 
2676  SourceLocation getReturnLoc() const { return ReturnStmtBits.RetLoc; }
2677  void setReturnLoc(SourceLocation L) { ReturnStmtBits.RetLoc = L; }
2678 
2679  SourceLocation getBeginLoc() const { return getReturnLoc(); }
2680  SourceLocation getEndLoc() const LLVM_READONLY {
2681  return RetExpr ? RetExpr->getEndLoc() : getReturnLoc();
2682  }
2683 
2684  static bool classof(const Stmt *T) {
2685  return T->getStmtClass() == ReturnStmtClass;
2686  }
2687 
2688  // Iterators
2690  if (RetExpr)
2691  return child_range(&RetExpr, &RetExpr + 1);
2693  }
2694 
2696  if (RetExpr)
2697  return const_child_range(&RetExpr, &RetExpr + 1);
2699  }
2700 };
2701 
2702 /// AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
2703 class AsmStmt : public Stmt {
2704 protected:
2705  friend class ASTStmtReader;
2706 
2708 
2709  /// True if the assembly statement does not have any input or output
2710  /// operands.
2711  bool IsSimple;
2712 
2713  /// If true, treat this inline assembly as having side effects.
2714  /// This assembly statement should not be optimized, deleted or moved.
2716 
2717  unsigned NumOutputs;
2718  unsigned NumInputs;
2719  unsigned NumClobbers;
2720 
2721  Stmt **Exprs = nullptr;
2722 
2723  AsmStmt(StmtClass SC, SourceLocation asmloc, bool issimple, bool isvolatile,
2724  unsigned numoutputs, unsigned numinputs, unsigned numclobbers)
2725  : Stmt (SC), AsmLoc(asmloc), IsSimple(issimple), IsVolatile(isvolatile),
2726  NumOutputs(numoutputs), NumInputs(numinputs),
2727  NumClobbers(numclobbers) {}
2728 
2729 public:
2730  /// Build an empty inline-assembly statement.
2731  explicit AsmStmt(StmtClass SC, EmptyShell Empty) : Stmt(SC, Empty) {}
2732 
2733  SourceLocation getAsmLoc() const { return AsmLoc; }
2734  void setAsmLoc(SourceLocation L) { AsmLoc = L; }
2735 
2736  bool isSimple() const { return IsSimple; }
2737  void setSimple(bool V) { IsSimple = V; }
2738 
2739  bool isVolatile() const { return IsVolatile; }
2740  void setVolatile(bool V) { IsVolatile = V; }
2741 
2742  SourceLocation getBeginLoc() const LLVM_READONLY { return {}; }
2743  SourceLocation getEndLoc() const LLVM_READONLY { return {}; }
2744 
2745  //===--- Asm String Analysis ---===//
2746 
2747  /// Assemble final IR asm string.
2748  std::string generateAsmString(const ASTContext &C) const;
2749 
2750  //===--- Output operands ---===//
2751 
2752  unsigned getNumOutputs() const { return NumOutputs; }
2753 
2754  /// getOutputConstraint - Return the constraint string for the specified
2755  /// output operand. All output constraints are known to be non-empty (either
2756  /// '=' or '+').
2757  StringRef getOutputConstraint(unsigned i) const;
2758 
2759  /// isOutputPlusConstraint - Return true if the specified output constraint
2760  /// is a "+" constraint (which is both an input and an output) or false if it
2761  /// is an "=" constraint (just an output).
2762  bool isOutputPlusConstraint(unsigned i) const {
2763  return getOutputConstraint(i)[0] == '+';
2764  }
2765 
2766  const Expr *getOutputExpr(unsigned i) const;
2767 
2768  /// getNumPlusOperands - Return the number of output operands that have a "+"
2769  /// constraint.
2770  unsigned getNumPlusOperands() const;
2771 
2772  //===--- Input operands ---===//
2773 
2774  unsigned getNumInputs() const { return NumInputs; }
2775 
2776  /// getInputConstraint - Return the specified input constraint. Unlike output
2777  /// constraints, these can be empty.
2778  StringRef getInputConstraint(unsigned i) const;
2779 
2780  const Expr *getInputExpr(unsigned i) const;
2781 
2782  //===--- Other ---===//
2783 
2784  unsigned getNumClobbers() const { return NumClobbers; }
2785  StringRef getClobber(unsigned i) const;
2786 
2787  static bool classof(const Stmt *T) {
2788  return T->getStmtClass() == GCCAsmStmtClass ||
2789  T->getStmtClass() == MSAsmStmtClass;
2790  }
2791 
2792  // Input expr iterators.
2793 
2796  using inputs_range = llvm::iterator_range<inputs_iterator>;
2797  using inputs_const_range = llvm::iterator_range<const_inputs_iterator>;
2798 
2800  return &Exprs[0] + NumOutputs;
2801  }
2802 
2804  return &Exprs[0] + NumOutputs + NumInputs;
2805  }
2806 
2807  inputs_range inputs() { return inputs_range(begin_inputs(), end_inputs()); }
2808 
2810  return &Exprs[0] + NumOutputs;
2811  }
2812 
2814  return &Exprs[0] + NumOutputs + NumInputs;
2815  }
2816 
2818  return inputs_const_range(begin_inputs(), end_inputs());
2819  }
2820 
2821  // Output expr iterators.
2822 
2825  using outputs_range = llvm::iterator_range<outputs_iterator>;
2826  using outputs_const_range = llvm::iterator_range<const_outputs_iterator>;
2827 
2829  return &Exprs[0];
2830  }
2831 
2833  return &Exprs[0] + NumOutputs;
2834  }
2835 
2837  return outputs_range(begin_outputs(), end_outputs());
2838  }
2839 
2841  return &Exprs[0];
2842  }
2843 
2845  return &Exprs[0] + NumOutputs;
2846  }
2847 
2849  return outputs_const_range(begin_outputs(), end_outputs());
2850  }
2851 
2853  return child_range(&Exprs[0], &Exprs[0] + NumOutputs + NumInputs);
2854  }
2855 
2857  return const_child_range(&Exprs[0], &Exprs[0] + NumOutputs + NumInputs);
2858  }
2859 };
2860 
2861 /// This represents a GCC inline-assembly statement extension.
2862 class GCCAsmStmt : public AsmStmt {
2863  friend class ASTStmtReader;
2864 
2865  SourceLocation RParenLoc;
2866  StringLiteral *AsmStr;
2867 
2868  // FIXME: If we wanted to, we could allocate all of these in one big array.
2869  StringLiteral **Constraints = nullptr;
2870  StringLiteral **Clobbers = nullptr;
2871  IdentifierInfo **Names = nullptr;
2872  unsigned NumLabels = 0;
2873 
2874 public:
2875  GCCAsmStmt(const ASTContext &C, SourceLocation asmloc, bool issimple,
2876  bool isvolatile, unsigned numoutputs, unsigned numinputs,
2877  IdentifierInfo **names, StringLiteral **constraints, Expr **exprs,
2878  StringLiteral *asmstr, unsigned numclobbers,
2879  StringLiteral **clobbers, unsigned numlabels,
2880  SourceLocation rparenloc);
2881 
2882  /// Build an empty inline-assembly statement.
2883  explicit GCCAsmStmt(EmptyShell Empty) : AsmStmt(GCCAsmStmtClass, Empty) {}
2884 
2885  SourceLocation getRParenLoc() const { return RParenLoc; }
2886  void setRParenLoc(SourceLocation L) { RParenLoc = L; }
2887 
2888  //===--- Asm String Analysis ---===//
2889 
2890  const StringLiteral *getAsmString() const { return AsmStr; }
2891  StringLiteral *getAsmString() { return AsmStr; }
2892  void setAsmString(StringLiteral *E) { AsmStr = E; }
2893 
2894  /// AsmStringPiece - this is part of a decomposed asm string specification
2895  /// (for use with the AnalyzeAsmString function below). An asm string is
2896  /// considered to be a concatenation of these parts.
2898  public:
2899  enum Kind {
2900  String, // String in .ll asm string form, "$" -> "$$" and "%%" -> "%".
2901  Operand // Operand reference, with optional modifier %c4.
2902  };
2903 
2904  private:
2905  Kind MyKind;
2906  std::string Str;
2907  unsigned OperandNo;
2908 
2909  // Source range for operand references.
2910  CharSourceRange Range;
2911 
2912  public:
2913  AsmStringPiece(const std::string &S) : MyKind(String), Str(S) {}
2914  AsmStringPiece(unsigned OpNo, const std::string &S, SourceLocation Begin,
2916  : MyKind(Operand), Str(S), OperandNo(OpNo),
2917  Range(CharSourceRange::getCharRange(Begin, End)) {}
2918 
2919  bool isString() const { return MyKind == String; }
2920  bool isOperand() const { return MyKind == Operand; }
2921 
2922  const std::string &getString() const { return Str; }
2923 
2924  unsigned getOperandNo() const {
2925  assert(isOperand());
2926  return OperandNo;
2927  }
2928 
2930  assert(isOperand() && "Range is currently used only for Operands.");
2931  return Range;
2932  }
2933 
2934  /// getModifier - Get the modifier for this operand, if present. This
2935  /// returns '\0' if there was no modifier.
2936  char getModifier() const;
2937  };
2938 
2939  /// AnalyzeAsmString - Analyze the asm string of the current asm, decomposing
2940  /// it into pieces. If the asm string is erroneous, emit errors and return
2941  /// true, otherwise return false. This handles canonicalization and
2942  /// translation of strings from GCC syntax to LLVM IR syntax, and handles
2943  //// flattening of named references like %[foo] to Operand AsmStringPiece's.
2944  unsigned AnalyzeAsmString(SmallVectorImpl<AsmStringPiece> &Pieces,
2945  const ASTContext &C, unsigned &DiagOffs) const;
2946 
2947  /// Assemble final IR asm string.
2948  std::string generateAsmString(const ASTContext &C) const;
2949 
2950  //===--- Output operands ---===//
2951 
2952  IdentifierInfo *getOutputIdentifier(unsigned i) const { return Names[i]; }
2953 
2954  StringRef getOutputName(unsigned i) const {
2955  if (IdentifierInfo *II = getOutputIdentifier(i))
2956  return II->getName();
2957 
2958  return {};
2959  }
2960 
2961  StringRef getOutputConstraint(unsigned i) const;
2962 
2963  const StringLiteral *getOutputConstraintLiteral(unsigned i) const {
2964  return Constraints[i];
2965  }
2967  return Constraints[i];
2968  }
2969 
2970  Expr *getOutputExpr(unsigned i);
2971 
2972  const Expr *getOutputExpr(unsigned i) const {
2973  return const_cast<GCCAsmStmt*>(this)->getOutputExpr(i);
2974  }
2975 
2976  //===--- Input operands ---===//
2977 
2978  IdentifierInfo *getInputIdentifier(unsigned i) const {
2979  return Names[i + NumOutputs];
2980  }
2981 
2982  StringRef getInputName(unsigned i) const {
2983  if (IdentifierInfo *II = getInputIdentifier(i))
2984  return II->getName();
2985 
2986  return {};
2987  }
2988 
2989  StringRef getInputConstraint(unsigned i) const;
2990 
2991  const StringLiteral *getInputConstraintLiteral(unsigned i) const {
2992  return Constraints[i + NumOutputs];
2993  }
2995  return Constraints[i + NumOutputs];
2996  }
2997 
2998  Expr *getInputExpr(unsigned i);
2999  void setInputExpr(unsigned i, Expr *E);
3000 
3001  const Expr *getInputExpr(unsigned i) const {
3002  return const_cast<GCCAsmStmt*>(this)->getInputExpr(i);
3003  }
3004 
3005  //===--- Labels ---===//
3006 
3007  bool isAsmGoto() const {
3008  return NumLabels > 0;
3009  }
3010 
3011  unsigned getNumLabels() const {
3012  return NumLabels;
3013  }
3014 
3015  IdentifierInfo *getLabelIdentifier(unsigned i) const {
3016  return Names[i + NumInputs];
3017  }
3018 
3019  AddrLabelExpr *getLabelExpr(unsigned i) const;
3020  StringRef getLabelName(unsigned i) const;
3023  using labels_range = llvm::iterator_range<labels_iterator>;
3024  using labels_const_range = llvm::iterator_range<const_labels_iterator>;
3025 
3027  return &Exprs[0] + NumInputs;
3028  }
3029 
3031  return &Exprs[0] + NumInputs + NumLabels;
3032  }
3033 
3035  return labels_range(begin_labels(), end_labels());
3036  }
3037 
3039  return &Exprs[0] + NumInputs;
3040  }
3041 
3043  return &Exprs[0] + NumInputs + NumLabels;
3044  }
3045 
3047  return labels_const_range(begin_labels(), end_labels());
3048  }
3049 
3050 private:
3051  void setOutputsAndInputsAndClobbers(const ASTContext &C,
3052  IdentifierInfo **Names,
3053  StringLiteral **Constraints,
3054  Stmt **Exprs,
3055  unsigned NumOutputs,
3056  unsigned NumInputs,
3057  unsigned NumLabels,
3058  StringLiteral **Clobbers,
3059  unsigned NumClobbers);
3060 
3061 public:
3062  //===--- Other ---===//
3063 
3064  /// getNamedOperand - Given a symbolic operand reference like %[foo],
3065  /// translate this into a numeric value needed to reference the same operand.
3066  /// This returns -1 if the operand name is invalid.
3067  int getNamedOperand(StringRef SymbolicName) const;
3068 
3069  StringRef getClobber(unsigned i) const;
3070 
3071  StringLiteral *getClobberStringLiteral(unsigned i) { return Clobbers[i]; }
3072  const StringLiteral *getClobberStringLiteral(unsigned i) const {
3073  return Clobbers[i];
3074  }
3075 
3076  SourceLocation getBeginLoc() const LLVM_READONLY { return AsmLoc; }
3077  SourceLocation getEndLoc() const LLVM_READONLY { return RParenLoc; }
3078 
3079  static bool classof(const Stmt *T) {
3080  return T->getStmtClass() == GCCAsmStmtClass;
3081  }
3082 };
3083 
3084 /// This represents a Microsoft inline-assembly statement extension.
3085 class MSAsmStmt : public AsmStmt {
3086  friend class ASTStmtReader;
3087 
3088  SourceLocation LBraceLoc, EndLoc;
3089  StringRef AsmStr;
3090 
3091  unsigned NumAsmToks = 0;
3092 
3093  Token *AsmToks = nullptr;
3094  StringRef *Constraints = nullptr;
3095  StringRef *Clobbers = nullptr;
3096 
3097 public:
3098  MSAsmStmt(const ASTContext &C, SourceLocation asmloc,
3099  SourceLocation lbraceloc, bool issimple, bool isvolatile,
3100  ArrayRef<Token> asmtoks, unsigned numoutputs, unsigned numinputs,
3101  ArrayRef<StringRef> constraints,
3102  ArrayRef<Expr*> exprs, StringRef asmstr,
3103  ArrayRef<StringRef> clobbers, SourceLocation endloc);
3104 
3105  /// Build an empty MS-style inline-assembly statement.
3106  explicit MSAsmStmt(EmptyShell Empty) : AsmStmt(MSAsmStmtClass, Empty) {}
3107 
3108  SourceLocation getLBraceLoc() const { return LBraceLoc; }
3109  void setLBraceLoc(SourceLocation L) { LBraceLoc = L; }
3110  SourceLocation getEndLoc() const { return EndLoc; }
3111  void setEndLoc(SourceLocation L) { EndLoc = L; }
3112 
3113  bool hasBraces() const { return LBraceLoc.isValid(); }
3114 
3115  unsigned getNumAsmToks() { return NumAsmToks; }
3116  Token *getAsmToks() { return AsmToks; }
3117 
3118  //===--- Asm String Analysis ---===//
3119  StringRef getAsmString() const { return AsmStr; }
3120 
3121  /// Assemble final IR asm string.
3122  std::string generateAsmString(const ASTContext &C) const;
3123 
3124  //===--- Output operands ---===//
3125 
3126  StringRef getOutputConstraint(unsigned i) const {
3127  assert(i < NumOutputs);
3128  return Constraints[i];
3129  }
3130 
3131  Expr *getOutputExpr(unsigned i);
3132 
3133  const Expr *getOutputExpr(unsigned i) const {
3134  return const_cast<MSAsmStmt*>(this)->getOutputExpr(i);
3135  }
3136 
3137  //===--- Input operands ---===//
3138 
3139  StringRef getInputConstraint(unsigned i) const {
3140  assert(i < NumInputs);
3141  return Constraints[i + NumOutputs];
3142  }
3143 
3144  Expr *getInputExpr(unsigned i);
3145  void setInputExpr(unsigned i, Expr *E);
3146 
3147  const Expr *getInputExpr(unsigned i) const {
3148  return const_cast<MSAsmStmt*>(this)->getInputExpr(i);
3149  }
3150 
3151  //===--- Other ---===//
3152 
3154  return llvm::makeArrayRef(Constraints, NumInputs + NumOutputs);
3155  }
3156 
3158  return llvm::makeArrayRef(Clobbers, NumClobbers);
3159  }
3160 
3162  return llvm::makeArrayRef(reinterpret_cast<Expr**>(Exprs),
3163  NumInputs + NumOutputs);
3164  }
3165 
3166  StringRef getClobber(unsigned i) const { return getClobbers()[i]; }
3167 
3168 private:
3169  void initialize(const ASTContext &C, StringRef AsmString,
3170  ArrayRef<Token> AsmToks, ArrayRef<StringRef> Constraints,
3171  ArrayRef<Expr*> Exprs, ArrayRef<StringRef> Clobbers);
3172 
3173 public:
3174  SourceLocation getBeginLoc() const LLVM_READONLY { return AsmLoc; }
3175 
3176  static bool classof(const Stmt *T) {
3177  return T->getStmtClass() == MSAsmStmtClass;
3178  }
3179 
3181  return child_range(&Exprs[0], &Exprs[NumInputs + NumOutputs]);
3182  }
3183 
3185  return const_child_range(&Exprs[0], &Exprs[NumInputs + NumOutputs]);
3186  }
3187 };
3188 
3189 class SEHExceptStmt : public Stmt {
3190  friend class ASTReader;
3191  friend class ASTStmtReader;
3192 
3193  SourceLocation Loc;
3194  Stmt *Children[2];
3195 
3196  enum { FILTER_EXPR, BLOCK };
3197 
3198  SEHExceptStmt(SourceLocation Loc, Expr *FilterExpr, Stmt *Block);
3199  explicit SEHExceptStmt(EmptyShell E) : Stmt(SEHExceptStmtClass, E) {}
3200 
3201 public:
3202  static SEHExceptStmt* Create(const ASTContext &C,
3203  SourceLocation ExceptLoc,
3204  Expr *FilterExpr,
3205  Stmt *Block);
3206 
3207  SourceLocation getBeginLoc() const LLVM_READONLY { return getExceptLoc(); }
3208 
3209  SourceLocation getExceptLoc() const { return Loc; }
3210  SourceLocation getEndLoc() const { return getBlock()->getEndLoc(); }
3211 
3212  Expr *getFilterExpr() const {
3213  return reinterpret_cast<Expr*>(Children[FILTER_EXPR]);
3214  }
3215 
3217  return cast<CompoundStmt>(Children[BLOCK]);
3218  }
3219 
3221  return child_range(Children, Children+2);
3222  }
3223 
3225  return const_child_range(Children, Children + 2);
3226  }
3227 
3228  static bool classof(const Stmt *T) {
3229  return T->getStmtClass() == SEHExceptStmtClass;
3230  }
3231 };
3232 
3233 class SEHFinallyStmt : public Stmt {
3234  friend class ASTReader;
3235  friend class ASTStmtReader;
3236 
3237  SourceLocation Loc;
3238  Stmt *Block;
3239 
3240  SEHFinallyStmt(SourceLocation Loc, Stmt *Block);
3241  explicit SEHFinallyStmt(EmptyShell E) : Stmt(SEHFinallyStmtClass, E) {}
3242 
3243 public:
3244  static SEHFinallyStmt* Create(const ASTContext &C,
3245  SourceLocation FinallyLoc,
3246  Stmt *Block);
3247 
3248  SourceLocation getBeginLoc() const LLVM_READONLY { return getFinallyLoc(); }
3249 
3250  SourceLocation getFinallyLoc() const { return Loc; }
3251  SourceLocation getEndLoc() const { return Block->getEndLoc(); }
3252 
3253  CompoundStmt *getBlock() const { return cast<CompoundStmt>(Block); }
3254 
3256  return child_range(&Block,&Block+1);
3257  }
3258 
3260  return const_child_range(&Block, &Block + 1);
3261  }
3262 
3263  static bool classof(const Stmt *T) {
3264  return T->getStmtClass() == SEHFinallyStmtClass;
3265  }
3266 };
3267 
3268 class SEHTryStmt : public Stmt {
3269  friend class ASTReader;
3270  friend class ASTStmtReader;
3271 
3272  bool IsCXXTry;
3273  SourceLocation TryLoc;
3274  Stmt *Children[2];
3275 
3276  enum { TRY = 0, HANDLER = 1 };
3277 
3278  SEHTryStmt(bool isCXXTry, // true if 'try' otherwise '__try'
3279  SourceLocation TryLoc,
3280  Stmt *TryBlock,
3281  Stmt *Handler);
3282 
3283  explicit SEHTryStmt(EmptyShell E) : Stmt(SEHTryStmtClass, E) {}
3284 
3285 public:
3286  static SEHTryStmt* Create(const ASTContext &C, bool isCXXTry,
3287  SourceLocation TryLoc, Stmt *TryBlock,
3288  Stmt *Handler);
3289 
3290  SourceLocation getBeginLoc() const LLVM_READONLY { return getTryLoc(); }
3291 
3292  SourceLocation getTryLoc() const { return TryLoc; }
3293  SourceLocation getEndLoc() const { return Children[HANDLER]->getEndLoc(); }
3294 
3295  bool getIsCXXTry() const { return IsCXXTry; }
3296 
3298  return cast<CompoundStmt>(Children[TRY]);
3299  }
3300 
3301  Stmt *getHandler() const { return Children[HANDLER]; }
3302 
3303  /// Returns 0 if not defined
3304  SEHExceptStmt *getExceptHandler() const;
3305  SEHFinallyStmt *getFinallyHandler() const;
3306 
3308  return child_range(Children, Children+2);
3309  }
3310 
3312  return const_child_range(Children, Children + 2);
3313  }
3314 
3315  static bool classof(const Stmt *T) {
3316  return T->getStmtClass() == SEHTryStmtClass;
3317  }
3318 };
3319 
3320 /// Represents a __leave statement.
3321 class SEHLeaveStmt : public Stmt {
3322  SourceLocation LeaveLoc;
3323 
3324 public:
3326  : Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}
3327 
3328  /// Build an empty __leave statement.
3329  explicit SEHLeaveStmt(EmptyShell Empty) : Stmt(SEHLeaveStmtClass, Empty) {}
3330 
3331  SourceLocation getLeaveLoc() const { return LeaveLoc; }
3332  void setLeaveLoc(SourceLocation L) { LeaveLoc = L; }
3333 
3334  SourceLocation getBeginLoc() const LLVM_READONLY { return LeaveLoc; }
3335  SourceLocation getEndLoc() const LLVM_READONLY { return LeaveLoc; }
3336 
3337  static bool classof(const Stmt *T) {
3338  return T->getStmtClass() == SEHLeaveStmtClass;
3339  }
3340 
3341  // Iterators
3344  }
3345 
3348  }
3349 };
3350 
3351 /// This captures a statement into a function. For example, the following
3352 /// pragma annotated compound statement can be represented as a CapturedStmt,
3353 /// and this compound statement is the body of an anonymous outlined function.
3354 /// @code
3355 /// #pragma omp parallel
3356 /// {
3357 /// compute();
3358 /// }
3359 /// @endcode
3360 class CapturedStmt : public Stmt {
3361 public:
3362  /// The different capture forms: by 'this', by reference, capture for
3363  /// variable-length array type etc.
3369  };
3370 
3371  /// Describes the capture of either a variable, or 'this', or
3372  /// variable-length array type.
3373  class Capture {
3374  llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
3375  SourceLocation Loc;
3376 
3377  public:
3378  friend class ASTStmtReader;
3379 
3380  /// Create a new capture.
3381  ///
3382  /// \param Loc The source location associated with this capture.
3383  ///
3384  /// \param Kind The kind of capture (this, ByRef, ...).
3385  ///
3386  /// \param Var The variable being captured, or null if capturing this.
3388  VarDecl *Var = nullptr);
3389 
3390  /// Determine the kind of capture.
3391  VariableCaptureKind getCaptureKind() const;
3392 
3393  /// Retrieve the source location at which the variable or 'this' was
3394  /// first used.
3395  SourceLocation getLocation() const { return Loc; }
3396 
3397  /// Determine whether this capture handles the C++ 'this' pointer.
3398  bool capturesThis() const { return getCaptureKind() == VCK_This; }
3399 
3400  /// Determine whether this capture handles a variable (by reference).
3401  bool capturesVariable() const { return getCaptureKind() == VCK_ByRef; }
3402 
3403  /// Determine whether this capture handles a variable by copy.
3404  bool capturesVariableByCopy() const {
3405  return getCaptureKind() == VCK_ByCopy;
3406  }
3407 
3408  /// Determine whether this capture handles a variable-length array
3409  /// type.
3411  return getCaptureKind() == VCK_VLAType;
3412  }
3413 
3414  /// Retrieve the declaration of the variable being captured.
3415  ///
3416  /// This operation is only valid if this capture captures a variable.
3417  VarDecl *getCapturedVar() const;
3418  };
3419 
3420 private:
3421  /// The number of variable captured, including 'this'.
3422  unsigned NumCaptures;
3423 
3424  /// The pointer part is the implicit the outlined function and the
3425  /// int part is the captured region kind, 'CR_Default' etc.
3426  llvm::PointerIntPair<CapturedDecl *, 2, CapturedRegionKind> CapDeclAndKind;
3427 
3428  /// The record for captured variables, a RecordDecl or CXXRecordDecl.
3429  RecordDecl *TheRecordDecl = nullptr;
3430 
3431  /// Construct a captured statement.
3433  ArrayRef<Expr *> CaptureInits, CapturedDecl *CD, RecordDecl *RD);
3434 
3435  /// Construct an empty captured statement.
3436  CapturedStmt(EmptyShell Empty, unsigned NumCaptures);
3437 
3438  Stmt **getStoredStmts() { return reinterpret_cast<Stmt **>(this + 1); }
3439 
3440  Stmt *const *getStoredStmts() const {
3441  return reinterpret_cast<Stmt *const *>(this + 1);
3442  }
3443 
3444  Capture *getStoredCaptures() const;
3445 
3446  void setCapturedStmt(Stmt *S) { getStoredStmts()[NumCaptures] = S; }
3447 
3448 public:
3449  friend class ASTStmtReader;
3450 
3451  static CapturedStmt *Create(const ASTContext &Context, Stmt *S,
3452  CapturedRegionKind Kind,
3453  ArrayRef<Capture> Captures,
3454  ArrayRef<Expr *> CaptureInits,
3455  CapturedDecl *CD, RecordDecl *RD);
3456 
3457  static CapturedStmt *CreateDeserialized(const ASTContext &Context,
3458  unsigned NumCaptures);
3459 
3460  /// Retrieve the statement being captured.
3461  Stmt *getCapturedStmt() { return getStoredStmts()[NumCaptures]; }
3462  const Stmt *getCapturedStmt() const { return getStoredStmts()[NumCaptures]; }
3463 
3464  /// Retrieve the outlined function declaration.
3465  CapturedDecl *getCapturedDecl();
3466  const CapturedDecl *getCapturedDecl() const;
3467 
3468  /// Set the outlined function declaration.
3469  void setCapturedDecl(CapturedDecl *D);
3470 
3471  /// Retrieve the captured region kind.
3472  CapturedRegionKind getCapturedRegionKind() const;
3473 
3474  /// Set the captured region kind.
3475  void setCapturedRegionKind(CapturedRegionKind Kind);
3476 
3477  /// Retrieve the record declaration for captured variables.
3478  const RecordDecl *getCapturedRecordDecl() const { return TheRecordDecl; }
3479 
3480  /// Set the record declaration for captured variables.
3482  assert(D && "null RecordDecl");
3483  TheRecordDecl = D;
3484  }
3485 
3486  /// True if this variable has been captured.
3487  bool capturesVariable(const VarDecl *Var) const;
3488 
3489  /// An iterator that walks over the captures.
3492  using capture_range = llvm::iterator_range<capture_iterator>;
3493  using capture_const_range = llvm::iterator_range<const_capture_iterator>;
3494 
3496  return capture_range(capture_begin(), capture_end());
3497  }
3499  return capture_const_range(capture_begin(), capture_end());
3500  }
3501 
3502  /// Retrieve an iterator pointing to the first capture.
3503  capture_iterator capture_begin() { return getStoredCaptures(); }
3504  const_capture_iterator capture_begin() const { return getStoredCaptures(); }
3505 
3506  /// Retrieve an iterator pointing past the end of the sequence of
3507  /// captures.
3509  return getStoredCaptures() + NumCaptures;
3510  }
3511 
3512  /// Retrieve the number of captures, including 'this'.
3513  unsigned capture_size() const { return NumCaptures; }
3514 
3515  /// Iterator that walks over the capture initialization arguments.
3517  using capture_init_range = llvm::iterator_range<capture_init_iterator>;
3518 
3519  /// Const iterator that walks over the capture initialization
3520  /// arguments.
3522  using const_capture_init_range =
3523  llvm::iterator_range<const_capture_init_iterator>;
3524 
3526  return capture_init_range(capture_init_begin(), capture_init_end());
3527  }
3528 
3530  return const_capture_init_range(capture_init_begin(), capture_init_end());
3531  }
3532 
3533  /// Retrieve the first initialization argument.
3535  return reinterpret_cast<Expr **>(getStoredStmts());
3536  }
3537 
3539  return reinterpret_cast<Expr *const *>(getStoredStmts());
3540  }
3541 
3542  /// Retrieve the iterator pointing one past the last initialization
3543  /// argument.
3545  return capture_init_begin() + NumCaptures;
3546  }
3547 
3549  return capture_init_begin() + NumCaptures;
3550  }
3551 
3552  SourceLocation getBeginLoc() const LLVM_READONLY {
3553  return getCapturedStmt()->getBeginLoc();
3554  }
3555 
3556  SourceLocation getEndLoc() const LLVM_READONLY {
3557  return getCapturedStmt()->getEndLoc();
3558  }
3559 
3560  SourceRange getSourceRange() const LLVM_READONLY {
3561  return getCapturedStmt()->getSourceRange();
3562  }
3563 
3564  static bool classof(const Stmt *T) {
3565  return T->getStmtClass() == CapturedStmtClass;
3566  }
3567 
3569 
3570  const_child_range children() const;
3571 };
3572 
3573 } // namespace clang
3574 
3575 #endif // LLVM_CLANG_AST_STMT_H
SourceLocation getRParenLoc() const
Definition: Stmt.h:2371
child_iterator child_begin()
Definition: Stmt.h:1178
Expr * getInc()
Definition: Stmt.h:2427
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:2186
labels_iterator end_labels()
Definition: Stmt.h:3030
static std::enable_if< std::is_base_of< Attr, AttrInfo >::value, SourceLocation >::type getAttrLoc(const AttrInfo &AL)
A helper function to provide Attribute Location for the Attr types AND the ParsedAttr.
void setCond(Expr *Cond)
Definition: Stmt.h:2267
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
Definition: ExprObjC.h:1577
A call to an overloaded operator written using operator syntax.
Definition: ExprCXX.h:78
GotoStmt(EmptyShell Empty)
Build an empty goto statement.
Definition: Stmt.h:2476
SourceLocation getRBracLoc() const
Definition: Stmt.h:1428
void setIsOMPStructuredBlock(bool IsOMPStructuredBlock)
Definition: Stmt.h:1104
IdentifierInfo * getInputIdentifier(unsigned i) const
Definition: Stmt.h:2978
ConstantExprBitfields ConstantExprBits
Definition: Stmt.h:969
static bool classof(const Stmt *T)
Definition: Stmt.h:2021
child_range children()
Definition: Stmt.h:2192
SourceLocation getRParenLoc() const
Definition: Stmt.h:2885
The null pointer literal (C++11 [lex.nullptr])
Definition: ExprCXX.h:683
This represents a GCC inline-assembly statement extension.
Definition: Stmt.h:2862
Stmt * body_back()
Definition: Stmt.h:1358
SourceLocation getBeginLoc() const
Definition: Stmt.h:2447
const Stmt * getElse() const
Definition: Stmt.h:1923
IdentifierInfo * getLabelIdentifier(unsigned i) const
Definition: Stmt.h:3015
body_iterator body_end()
Definition: Stmt.h:1355
unsigned getNumInputs() const
Definition: Stmt.h:2774
SourceLocation getBeginLoc() const
Definition: Stmt.h:2679
UnresolvedMemberExprBitfields UnresolvedMemberExprBits
Definition: Stmt.h:1008
CompoundStmt * getBlock() const
Definition: Stmt.h:3253
SourceLocation getForLoc() const
Definition: Stmt.h:2440
SourceLocation getEndLoc() const
Definition: Stmt.h:2566
const Stmt * getBody() const
Definition: Stmt.h:2364
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument.
Definition: Stmt.h:3534
capture_const_range captures() const
Definition: Stmt.h:3498
const_child_iterator child_end() const
Definition: Stmt.h:1182
CXXDeleteExprBitfields CXXDeleteExprBits
Definition: Stmt.h:999
DefaultStmt(SourceLocation DL, SourceLocation CL, Stmt *substmt)
Definition: Stmt.h:1648
SourceLocation getEllipsisLoc() const
Get the location of the ... in a case statement of the form LHS ... RHS.
Definition: Stmt.h:1563
void setNRVOCandidate(const VarDecl *Var)
Set the variable that might be used for the named return value optimization.
Definition: Stmt.h:2670
static bool classof(const Stmt *T)
Definition: Stmt.h:3176
Expr * getCond()
Definition: Stmt.h:2259
inputs_range inputs()
Definition: Stmt.h:2807
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Definition: ExprCXX.h:2627
bool hasVarStorage() const
True if this IfStmt has storage for a variable declaration.
Definition: Stmt.h:1892
const_labels_iterator end_labels() const
Definition: Stmt.h:3042
unsigned getNumAsmToks()
Definition: Stmt.h:3115
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
Definition: Dominators.h:30
const_reverse_body_iterator body_rbegin() const
Definition: Stmt.h:1396
outputs_iterator end_outputs()
Definition: Stmt.h:2832
const DeclStmt * getConditionVariableDeclStmt() const
If this ForStmt has a condition variable, return the faux DeclStmt associated with the creation of th...
Definition: Stmt.h:2422
CXXThisExprBitfields CXXThisExprBits
Definition: Stmt.h:993
IndirectGotoStmt(EmptyShell Empty)
Build an empty indirect goto statement.
Definition: Stmt.h:2516
std::reverse_iterator< const_body_iterator > const_reverse_body_iterator
Definition: Stmt.h:1394
CXXUnresolvedConstructExprBitfields CXXUnresolvedConstructExprBits
Definition: Stmt.h:1004
Stmt - This represents one statement.
Definition: Stmt.h:66
SourceLocation getEndLoc() const
Definition: Stmt.h:2448
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1822
AsmStmt(StmtClass SC, EmptyShell Empty)
Build an empty inline-assembly statement.
Definition: Stmt.h:2731
bool capturesThis() const
Determine whether this capture handles the C++ &#39;this&#39; pointer.
Definition: Stmt.h:3398
unsigned getNumOutputs() const
Definition: Stmt.h:2752
llvm::iterator_range< body_iterator > body_range
Definition: Stmt.h:1351
ContinueStmt(EmptyShell Empty)
Build an empty continue statement.
Definition: Stmt.h:2560
llvm::iterator_range< labels_iterator > labels_range
Definition: Stmt.h:3023
const StringLiteral * getAsmString() const
Definition: Stmt.h:2890
void setRParenLoc(SourceLocation L)
Definition: Stmt.h:2886
void setContinueLoc(SourceLocation L)
Definition: Stmt.h:2563
const_child_range children() const
Definition: Stmt.h:2498
iterator end()
Definition: DeclGroup.h:105
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
void setDeclGroup(DeclGroupRef DGR)
Definition: Stmt.h:1233
bool hasLeadingEmptyMacro() const
Definition: Stmt.h:1299
LabelStmtBitfields LabelStmtBits
Definition: Stmt.h:954
FloatingLiteralBitfields FloatingLiteralBits
Definition: Stmt.h:972
NullStmt(EmptyShell Empty)
Build an empty null statement.
Definition: Stmt.h:1294
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:3037
const Expr * getOutputExpr(unsigned i) const
Definition: Stmt.h:3133
SourceLocation getIdentLoc() const
Definition: Stmt.h:1734
Represents an attribute applied to a statement.
Definition: Stmt.h:1764
const_child_range children() const
Definition: Stmt.h:2015
const Expr * getOutputExpr(unsigned i) const
Definition: Stmt.h:2972
llvm::iterator_range< child_iterator > child_range
Definition: Stmt.h:1168
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
Definition: Stmt.h:3478
DeclRefExprBitfields DeclRefExprBits
Definition: Stmt.h:971
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1422
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:1239
unsigned NumOutputs
Definition: Stmt.h:2717
bool getIsCXXTry() const
Definition: Stmt.h:3295
child_range children()
Definition: Stmt.h:3342
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
void setSwitchCaseList(SwitchCase *SC)
Definition: Stmt.h:2158
NullStmt(SourceLocation L, bool hasLeadingEmptyMacro=false)
Definition: Stmt.h:1287
bool hasVarStorage() const
True if this SwitchStmt has storage for a condition variable.
Definition: Stmt.h:2085
void setStartLoc(SourceLocation L)
Definition: Stmt.h:1235
SourceLocation getGotoLoc() const
Definition: Stmt.h:2520
void setForLoc(SourceLocation L)
Definition: Stmt.h:2441
const_child_iterator child_begin() const
Definition: Stmt.h:1181
Stmt * getSubStmt()
Definition: Stmt.h:1655
Represents a variable declaration or definition.
Definition: Decl.h:827
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization. ...
Definition: Stmt.h:2662
SourceLocation getLParenLoc() const
Definition: Stmt.h:2442
const_child_range children() const
Definition: Stmt.h:1812
const_child_range children() const
Definition: Stmt.h:2695
static bool classof(const Stmt *T)
Definition: Stmt.h:1430
void setAsmLoc(SourceLocation L)
Definition: Stmt.h:2734
AttributedStmtBitfields AttributedStmtBits
Definition: Stmt.h:955
bool hasInitStorage() const
True if this SwitchStmt has storage for an init statement.
Definition: Stmt.h:2082
const_outputs_iterator begin_outputs() const
Definition: Stmt.h:2840
const Expr * getCond() const
Definition: Stmt.h:2431
Stmt * getThen()
Definition: Stmt.h:1909
SourceLocation getIfLoc() const
Definition: Stmt.h:1981
const Expr * getExprStmt() const
Definition: Stmt.cpp:334
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:37
capture_iterator capture_begin()
Retrieve an iterator pointing to the first capture.
Definition: Stmt.h:3503
static StringRef bytes(const std::vector< T, Allocator > &v)
Definition: ASTWriter.cpp:119
CharSourceRange getSourceRange(const SourceRange &Range)
Returns the token CharSourceRange corresponding to Range.
Definition: FixIt.h:32
A C++ throw-expression (C++ [except.throw]).
Definition: ExprCXX.h:1140
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Definition: ExprCXX.h:3306
llvm::iterator_range< decl_iterator > decl_range
Definition: Stmt.h:1258
StringRef getInputName(unsigned i) const
Definition: Stmt.h:2982
void setThen(Stmt *Then)
Definition: Stmt.h:1914
void setBody(Stmt *S, SourceLocation SL)
Definition: Stmt.h:2163
Stmt(StmtClass SC, EmptyShell)
Construct an empty statement.
Definition: Stmt.h:1078
void setTarget(Expr *E)
Definition: Stmt.h:2528
CoawaitExprBitfields CoawaitBits
Definition: Stmt.h:1013
static bool classof(const Stmt *T)
Definition: Stmt.h:3315
ArraySubscriptExprBitfields ArraySubscriptExprBits
Definition: Stmt.h:977
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1720
Represents a struct/union/class.
Definition: Decl.h:3662
Represents a C99 designated initializer expression.
Definition: Expr.h:4611
const Expr * getTarget() const
Definition: Stmt.h:2525
inputs_iterator begin_inputs()
Definition: Stmt.h:2799
One of these records is kept for each identifier that is lexed.
Stmt * getBody()
Definition: Stmt.h:2363
Represents a statement that could possibly have a value and type.
Definition: Stmt.h:1701
const_outputs_iterator end_outputs() const
Definition: Stmt.h:2844
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(), or __builtin_FILE().
Definition: Expr.h:4267
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Definition: Expr.h:3971
SourceLocation ColonLoc
The location of the ":".
Definition: Stmt.h:1446
DeclGroupRef::const_iterator const_decl_iterator
Definition: Stmt.h:1257
DeclStmt * getConditionVariableDeclStmt()
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
Definition: Stmt.h:2144
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:160
child_range children()
Definition: Stmt.h:3255
const_body_iterator body_begin() const
Definition: Stmt.h:1369
SourceLocation getEndLoc() const
Definition: Stmt.h:1236
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:3334
LabelStmt(SourceLocation IL, LabelDecl *D, Stmt *substmt)
Build a label statement.
Definition: Stmt.h:1726
CharSourceRange getRange() const
Definition: Stmt.h:2929
CharacterLiteralBitfields CharacterLiteralBits
Definition: Stmt.h:974
ArrayRef< Expr * > getAllExprs() const
Definition: Stmt.h:3161
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:3290
Stmt * getStmtExprResult()
Definition: Stmt.h:1412
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:2742
SourceLocation getBeginLoc() const
Definition: Stmt.h:1303
SourceLocation getEndLoc() const
Definition: Stmt.h:3293
Token - This structure provides full information about a lexed token.
Definition: Token.h:34
ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits
Definition: Stmt.h:1016
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
Definition: opencl-c-base.h:40
Stmt *const * const_body_iterator
Definition: Stmt.h:1362
Stmt * body_front()
Definition: Stmt.h:1356
void setReturnLoc(SourceLocation L)
Definition: Stmt.h:2677
llvm::iterator_range< const_inputs_iterator > inputs_const_range
Definition: Stmt.h:2797
MSAsmStmt(EmptyShell Empty)
Build an empty MS-style inline-assembly statement.
Definition: Stmt.h:3106
bool isAsmGoto() const
Definition: Stmt.h:3007
const VarDecl * getConditionVariable() const
Definition: Stmt.h:1943
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
Definition: ExprCXX.h:3771
void setCond(Expr *Cond)
Definition: Stmt.h:2095
const DeclGroupRef getDeclGroup() const
Definition: Stmt.h:1231
void setIfLoc(SourceLocation IfLoc)
Definition: Stmt.h:1982
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:2181
static bool classof(const Stmt *T)
Definition: Stmt.h:2787
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
Definition: ExprObjC.h:188
child_range children()
Definition: Stmt.h:3180
void setSubStmt(Stmt *S)
Definition: Stmt.h:1612
child_range children()
Definition: Stmt.h:2382
SwitchCase(StmtClass SC, SourceLocation KWLoc, SourceLocation ColonLoc)
Definition: Stmt.h:1455
WhileStmtBitfields WhileStmtBits
Definition: Stmt.h:958
const Stmt * getSubStmt() const
Definition: Stmt.h:1743
void addSwitchCase(SwitchCase *SC)
Definition: Stmt.h:2168
child_range children()
Definition: Stmt.h:1310
child_range children()
Definition: Stmt.h:3307
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:3335
static bool classof(const Stmt *T)
Definition: Stmt.h:2319
IndirectGotoStmt - This represents an indirect goto.
Definition: Stmt.h:2504
Describes an C or C++ initializer list.
Definition: Expr.h:4375
SwitchCase(StmtClass SC, EmptyShell)
Definition: Stmt.h:1460
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
Definition: Stmt.h:3521
GCCAsmStmt(EmptyShell Empty)
Build an empty inline-assembly statement.
Definition: Stmt.h:2883
child_range children()
Definition: Stmt.h:1810
ForStmt - This represents a &#39;for (init;cond;inc)&#39; stmt.
Definition: Stmt.h:2394
SourceLocation getBeginLoc() const
Definition: Stmt.h:1616
outputs_iterator begin_outputs()
Definition: Stmt.h:2828
Decl * getSingleDecl()
Definition: DeclGroup.h:83
CXXScalarValueInitExprBitfields CXXScalarValueInitExprBits
Definition: Stmt.h:997
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1808
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
LabelDecl * getDecl() const
Definition: Stmt.h:1737
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SourceLocation getLBracLoc() const
Definition: Stmt.h:1427
void setEndLoc(SourceLocation L)
Definition: Stmt.h:1237
DeclStmt(EmptyShell Empty)
Build an empty declaration statement.
Definition: Stmt.h:1222
static bool classof(const Stmt *T)
Definition: Stmt.h:1712
Stmt * getBody()
Definition: Stmt.h:2428
SwitchCaseBitfields SwitchCaseBits
Definition: Stmt.h:965
llvm::iterator_range< const_outputs_iterator > outputs_const_range
Definition: Stmt.h:2826
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3409
Stmt * getInit()
Definition: Stmt.h:2407
DoStmt(Stmt *Body, Expr *Cond, SourceLocation DL, SourceLocation WL, SourceLocation RP)
Definition: Stmt.h:2345
const_child_range children() const
Definition: Stmt.h:3224
SwitchStmtBitfields SwitchStmtBits
Definition: Stmt.h:957
iterator begin()
Definition: DeclGroup.h:99
const StringLiteral * getInputConstraintLiteral(unsigned i) const
Definition: Stmt.h:2991
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:3174
bool hasElseStorage() const
True if this IfStmt has storage for an else statement.
Definition: Stmt.h:1895
labels_range labels()
Definition: Stmt.h:3034
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1747
child_range children()
Definition: Stmt.h:1749
void setAsmString(StringLiteral *E)
Definition: Stmt.h:2892
static bool classof(const Stmt *T)
Definition: Stmt.h:2684
AsmStmt(StmtClass SC, SourceLocation asmloc, bool issimple, bool isvolatile, unsigned numoutputs, unsigned numinputs, unsigned numclobbers)
Definition: Stmt.h:2723
const Stmt * getInit() const
Definition: Stmt.h:2113
SourceLocation getEndLoc() const
Definition: Stmt.h:2596
const VarDecl * getConditionVariable() const
Definition: Stmt.h:2289
const Expr * getInc() const
Definition: Stmt.h:2432
CaseStmt - Represent a case statement.
Definition: Stmt.h:1488
Expr * getCond()
Definition: Stmt.h:2426
SourceLocation getContinueLoc() const
Definition: Stmt.h:2562
void setLHS(Expr *Val)
Definition: Stmt.h:1585
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3125
void setInit(Stmt *Init)
Definition: Stmt.h:2118
StringLiteral * getClobberStringLiteral(unsigned i)
Definition: Stmt.h:3071
StringRef getOutputName(unsigned i) const
Definition: Stmt.h:2954
ReturnStmtBitfields ReturnStmtBits
Definition: Stmt.h:964
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:2315
void setCond(Expr *E)
Definition: Stmt.h:2436
bool isOutputPlusConstraint(unsigned i) const
isOutputPlusConstraint - Return true if the specified output constraint is a "+" constraint (which is...
Definition: Stmt.h:2762
decl_iterator decl_end()
Definition: Stmt.h:1268
const Expr * getCond() const
Definition: Stmt.h:2263
SourceLocation getTryLoc() const
Definition: Stmt.h:3292
void setEndLoc(SourceLocation L)
Definition: Stmt.h:3111
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3511
child_range children()
Definition: Stmt.h:1435
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4140
StmtClass
Definition: Stmt.h:68
Stmt * getBody()
Definition: Stmt.h:2099
const Expr * getLHS() const
Definition: Stmt.h:1581
Stmt * getInit()
Definition: Stmt.h:1965
A default argument (C++ [dcl.fct.default]).
Definition: ExprCXX.h:1202
const_child_range children() const
Definition: Stmt.h:3311
const_body_iterator body_end() const
Definition: Stmt.h:1373
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:2680
const_labels_iterator begin_labels() const
Definition: Stmt.h:3038
unsigned NumClobbers
Definition: Stmt.h:2719
Represents the this expression in C++.
Definition: ExprCXX.h:1097
PredefinedExprBitfields PredefinedExprBits
Definition: Stmt.h:970
const_decl_iterator decl_begin() const
Definition: Stmt.h:1269
StringLiteral * getAsmString()
Definition: Stmt.h:2891
StmtBitfields StmtBits
Definition: Stmt.h:951
child_range children()
Definition: Stmt.h:1631
llvm::iterator_range< const_child_iterator > const_child_range
Definition: Stmt.h:1169
const_child_range children() const
Definition: Stmt.h:3184
void setBreakLoc(SourceLocation L)
Definition: Stmt.h:2593
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition: Stmt.h:1320
const_child_range children() const
Definition: Stmt.h:2856
Describes the capture of either a variable, or &#39;this&#39;, or variable-length array type.
Definition: Stmt.h:3373
Stmt * stripLabelLikeStatements()
Definition: Stmt.h:1157
Decl * getSingleDecl()
Definition: Stmt.h:1229
static bool classof(const Stmt *T)
Definition: Stmt.h:2540
const_inputs_iterator begin_inputs() const
Definition: Stmt.h:2809
void setSemiLoc(SourceLocation L)
Definition: Stmt.h:1297
const Expr * getRetValue() const
Definition: Stmt.h:2654
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:3207
child_range children()
Definition: Stmt.h:2852
bool IsVolatile
If true, treat this inline assembly as having side effects.
Definition: Stmt.h:2715
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2347
BreakStmtBitfields BreakStmtBits
Definition: Stmt.h:963
static bool classof(const Stmt *T)
Definition: Stmt.h:3228
static bool classof(const Stmt *T)
Definition: Stmt.h:2450
bool isConstexpr() const
Definition: Stmt.h:1995
CastIterator(StmtPtr *I)
Definition: Stmt.h:1058
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:2001
unsigned getOperandNo() const
Definition: Stmt.h:2924
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
Definition: Expr.h:953
const DeclStmt * getConditionVariableDeclStmt() const
Definition: Stmt.h:1959
SourceLocation getBeginLoc() const
Definition: Stmt.h:1662
SourceLocation getLabelLoc() const
Definition: Stmt.h:2483
llvm::iterator_range< const_capture_iterator > capture_const_range
Definition: Stmt.h:3493
void setLeaveLoc(SourceLocation L)
Definition: Stmt.h:3332
const Stmt * getSubStmt() const
Definition: Stmt.h:1805
SubstNonTypeTemplateParmExprBitfields SubstNonTypeTemplateParmExprBits
Definition: Stmt.h:1010
const Stmt * getSubStmt() const
Definition: Stmt.h:1656
void setRParenLoc(SourceLocation L)
Definition: Stmt.h:2372
SourceLocation getFinallyLoc() const
Definition: Stmt.h:3250
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
Definition: ExprCXX.h:2053
GotoStmt(LabelDecl *label, SourceLocation GL, SourceLocation LL)
Definition: Stmt.h:2470
This represents one expression.
Definition: Expr.h:108
SourceRange getSourceRange() const LLVM_READONLY
Definition: Stmt.h:3560
CXXRewrittenBinaryOperatorBitfields CXXRewrittenBinaryOperatorBits
Definition: Stmt.h:990
void setInit(Stmt *Init)
Definition: Stmt.h:1975
SourceLocation getElseLoc() const
Definition: Stmt.h:1984
SourceLocation End
void setWhileLoc(SourceLocation L)
Definition: Stmt.h:2312
Represents a character-granular source range.
inputs_const_range inputs() const
Definition: Stmt.h:2817
llvm::iterator_range< const_capture_init_iterator > const_capture_init_range
Definition: Stmt.h:3523
ArrayRef< StringRef > getClobbers() const
Definition: Stmt.h:3157
std::string Label
InitListExprBitfields InitListExprBits
Definition: Stmt.h:982
static bool classof(const Stmt *T)
Definition: Stmt.h:3337
StringRef getClobber(unsigned i) const
Definition: Stmt.h:3166
SourceLocation getDefaultLoc() const
Definition: Stmt.h:1659
void setLParenLoc(SourceLocation L)
Definition: Stmt.h:2443
const StringLiteral * getClobberStringLiteral(unsigned i) const
Definition: Stmt.h:3072
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1617
SourceLocation getWhileLoc() const
Definition: Stmt.h:2311
const Stmt * getThen() const
Definition: Stmt.h:1910
SourceLocation getEndLoc() const
Definition: Stmt.h:2487
AsmStringPiece - this is part of a decomposed asm string specification (for use with the AnalyzeAsmSt...
Definition: Stmt.h:2897
const Expr * getInputExpr(unsigned i) const
Definition: Stmt.h:3001
#define V(N, I)
Definition: ASTContext.h:2921
const Stmt * getCapturedStmt() const
Definition: Stmt.h:3462
void setInc(Expr *E)
Definition: Stmt.h:2437
Stmt * getBody()
Definition: Stmt.h:2271
void setRetValue(Expr *E)
Definition: Stmt.h:2655
void setBody(Stmt *S)
Definition: Stmt.h:2438
GotoStmtBitfields GotoStmtBits
Definition: Stmt.h:961
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
Definition: ExprObjC.h:304
Expr * getRHS()
Definition: Stmt.h:1589
ExprBitfields ExprBits
Definition: Stmt.h:968
void setBody(Stmt *Body)
Definition: Stmt.h:2104
SourceLocation Begin
child_range children()
Definition: Stmt.h:2009
CXXDefaultInitExprBitfields CXXDefaultInitExprBits
Definition: Stmt.h:996
unsigned size() const
Definition: Stmt.h:1348
SourceLocation getBeginLoc() const
Definition: Stmt.h:2000
ExprWithCleanupsBitfields ExprWithCleanupsBits
Definition: Stmt.h:1003
std::reverse_iterator< body_iterator > reverse_body_iterator
Definition: Stmt.h:1383
bool isOMPStructuredBlock() const
Definition: Stmt.h:1103
static bool classof(const Stmt *T)
Definition: Stmt.h:1306
CompoundStmtBitfields CompoundStmtBits
Definition: Stmt.h:953
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
capture_init_range capture_inits()
Definition: Stmt.h:3525
StringLiteralBitfields StringLiteralBits
Definition: Stmt.h:973
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:2913
ForStmt(EmptyShell Empty)
Build an empty for statement.
Definition: Stmt.h:2405
SourceLocation getSwitchLoc() const
Definition: Stmt.h:2160
StringLiteral * getOutputConstraintLiteral(unsigned i)
Definition: Stmt.h:2966
LabelDecl * getLabel() const
Definition: Stmt.h:2478
child_range children()
Definition: Stmt.h:2545
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
Definition: Stmt.h:2620
const_child_range children() const
Definition: Stmt.h:3259
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:950
void setBody(Stmt *Body)
Definition: Stmt.h:2276
This represents a Microsoft inline-assembly statement extension.
Definition: Stmt.h:3085
void setColonLoc(SourceLocation L)
Definition: Stmt.h:1470
SourceLocation getDoLoc() const
Definition: Stmt.h:2367
SwitchCase * getSwitchCaseList()
Definition: Stmt.h:2156
UnaryOperator - This represents the unary-expression&#39;s (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Definition: Expr.h:2021
llvm::iterator_range< const_decl_iterator > decl_const_range
Definition: Stmt.h:1259
child_range children()
Definition: Stmt.h:1672
child_range children()
Definition: Stmt.h:2573
Represents a reference to a non-type template parameter that has been substituted with a template arg...
Definition: ExprCXX.h:4209
Expr * getCond()
Definition: Stmt.h:1897
SourceLocation getEndLoc() const
Definition: Stmt.h:1304
SourceLocation getBeginLoc() const
Definition: Stmt.h:2314
static bool classof(const Stmt *T)
Definition: Stmt.h:2489
const SourceManager & SM
Definition: Format.cpp:1667
SourceLocation getEndLoc() const
Definition: Stmt.h:1425
const_child_range children() const
Definition: Stmt.h:2330
const_inputs_iterator end_inputs() const
Definition: Stmt.h:2813
const Expr * getCond() const
Definition: Stmt.h:2357
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.cpp:287
DoStmt - This represents a &#39;do/while&#39; stmt.
Definition: Stmt.h:2338
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
Definition: Stmt.h:2703
const_child_range children() const
Definition: Stmt.h:1637
child_range children()
Definition: Stmt.h:2603
std::reverse_iterator< decl_iterator > reverse_decl_iterator
Definition: Stmt.h:1272
const_child_range children() const
Definition: Stmt.h:2547
const Stmt * IgnoreContainers(bool IgnoreCaptured=false) const
Definition: Stmt.h:1152
SourceLocation getEndLoc() const
Definition: Stmt.h:3210
OpaqueValueExprBitfields OpaqueValueExprBits
Definition: Stmt.h:1019
const_child_range children() const
Definition: Stmt.h:1751
decl_const_range decls() const
Definition: Stmt.h:1263
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
Definition: Expr.h:1050
const_child_range children() const
Definition: Stmt.h:2198
void setDecl(LabelDecl *D)
Definition: Stmt.h:1738
ParenListExprBitfields ParenListExprBits
Definition: Stmt.h:983
static bool classof(const Stmt *T)
Definition: Stmt.h:3564
Kind
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr...
Definition: ExprCXX.h:2844
This captures a statement into a function.
Definition: Stmt.h:3360
Token * getAsmToks()
Definition: Stmt.h:3116
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:5673
void setSubStmt(Stmt *S)
Definition: Stmt.h:1657
SourceLocation getBeginLoc() const
Definition: Stmt.h:2185
void setGotoLoc(SourceLocation L)
Definition: Stmt.h:2519
ContinueStmtBitfields ContinueStmtBits
Definition: Stmt.h:962
Encodes a location in the source.
body_range body()
Definition: Stmt.h:1353
Expr * getRetValue()
Definition: Stmt.h:2653
StringRef getOutputConstraint(unsigned i) const
Definition: Stmt.h:3126
bool hasVarStorage() const
True if this WhileStmt has storage for a condition variable.
Definition: Stmt.h:2257
PseudoObjectExprBitfields PseudoObjectExprBits
Definition: Stmt.h:985
UnresolvedLookupExprBitfields UnresolvedLookupExprBits
Definition: Stmt.h:1007
IfStmtBitfields IfStmtBits
Definition: Stmt.h:956
CXXThrowExprBitfields CXXThrowExprBits
Definition: Stmt.h:994
SEHLeaveStmt(EmptyShell Empty)
Build an empty __leave statement.
Definition: Stmt.h:3329
const SwitchCase * getSwitchCaseList() const
Definition: Stmt.h:2157
void setDoLoc(SourceLocation L)
Definition: Stmt.h:2368
child_range children()
Definition: Stmt.h:3220
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:2100
Expr * getLHS()
Definition: Stmt.h:1577
void setConstexpr(bool C)
Definition: Stmt.h:1996
SourceLocation getExceptLoc() const
Definition: Stmt.h:3209
const_capture_iterator capture_begin() const
Definition: Stmt.h:3504
void setIdentLoc(SourceLocation L)
Definition: Stmt.h:1735
Stmt * getElse()
Definition: Stmt.h:1918
const_child_range children() const
Definition: Stmt.h:1437
GenericSelectionExprBitfields GenericSelectionExprBits
Definition: Stmt.h:984
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Definition: Stmt.h:1213
Represents the declaration of a label.
Definition: Decl.h:476
bool capturesVariable() const
Determine whether this capture handles a variable (by reference).
Definition: Stmt.h:3401
reverse_body_iterator body_rend()
Definition: Stmt.h:1389
ForStmtBitfields ForStmtBits
Definition: Stmt.h:960
SourceLocation getLBraceLoc() const
Definition: Stmt.h:3108
const std::string & getString() const
Definition: Stmt.h:2922
labels_const_range labels() const
Definition: Stmt.h:3046
Expr * getCond()
Definition: Stmt.h:2087
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:2177
typename CastIterator::iterator_adaptor_base Base
Definition: Stmt.h:1055
CompoundStmt(SourceLocation Loc)
Definition: Stmt.h:1338
const_child_range children() const
Definition: Stmt.h:2459
const_child_range children() const
Definition: Stmt.h:1251
static bool classof(const Stmt *T)
Definition: Stmt.h:2598
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:5807
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:3076
decl_iterator decl_begin()
Definition: Stmt.h:1267
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:3248
SourceLocation getGotoLoc() const
Definition: Stmt.h:2481
const_child_range children() const
Definition: Stmt.h:1674
reverse_decl_iterator decl_rbegin()
Definition: Stmt.h:1274
SEHLeaveStmt(SourceLocation LL)
Definition: Stmt.h:3325
Expr * getExprStmt()
Definition: Stmt.h:1707
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
Definition: Stmt.h:2963
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3249
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition: Stmt.h:3461
const Stmt * body_front() const
Definition: Stmt.h:1375
const VarDecl * getConditionVariable() const
Definition: Stmt.h:2134
unsigned capture_size() const
Retrieve the number of captures, including &#39;this&#39;.
Definition: Stmt.h:3513
const Stmt * getBody() const
Definition: Stmt.h:2433
void setCaseLoc(SourceLocation L)
Definition: Stmt.h:1560
SourceLocation getEndLoc() const
Definition: Stmt.h:3110
Base::value_type operator*() const
Definition: Stmt.h:1060
DoStmtBitfields DoStmtBits
Definition: Stmt.h:959
NullStmtBitfields NullStmtBits
Definition: Stmt.h:952
LabelStmt(EmptyShell Empty)
Build an empty label statement.
Definition: Stmt.h:1732
const_capture_init_range capture_inits() const
Definition: Stmt.h:3529
DeclStmt * getConditionVariableDeclStmt()
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
Definition: Stmt.h:2299
SourceLocation getKeywordLoc() const
Definition: Stmt.h:1467
MemberExprBitfields MemberExprBits
Definition: Stmt.h:979
SourceLocation getBeginLoc() const
Definition: Stmt.h:2565
SourceLocation getStarLoc() const
Definition: Stmt.h:2522
const DeclStmt * getConditionVariableDeclStmt() const
Definition: Stmt.h:2305
void setCapturedRecordDecl(RecordDecl *D)
Set the record declaration for captured variables.
Definition: Stmt.h:3481
A placeholder type used to construct an empty shell of a type, that will be filled in later (e...
Definition: Stmt.h:1044
void setSimple(bool V)
Definition: Stmt.h:2737
A qualified reference to a name whose declaration cannot yet be resolved.
Definition: ExprCXX.h:3155
Represents a C11 generic selection.
Definition: Expr.h:5206
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3882
const_child_range children() const
Definition: Stmt.h:1173
void setGotoLoc(SourceLocation L)
Definition: Stmt.h:2482
NullStmt - This is the null statement ";": C99 6.8.3p3.
Definition: Stmt.h:1285
llvm::iterator_range< const_labels_iterator > labels_const_range
Definition: Stmt.h:3024
StringRef getInputConstraint(unsigned i) const
Definition: Stmt.h:3139
Dataflow Directional Tag Classes.
bool isValid() const
Return true if this is a valid SourceLocation object.
bool isVolatile() const
Definition: Stmt.h:2739
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1878
CXXNullPtrLiteralExprBitfields CXXNullPtrLiteralExprBits
Definition: Stmt.h:992
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2359
IdentifierInfo * getOutputIdentifier(unsigned i) const
Definition: Stmt.h:2952
bool isSimple() const
Definition: Stmt.h:2736
static std::string getName(const CallEvent &Call)
llvm::iterator_range< outputs_iterator > outputs_range
Definition: Stmt.h:2825
ArrayRef< const Attr * > getAttrs() const
Definition: Stmt.h:1800
bool hasInitStorage() const
True if this IfStmt has the storage for an init statement.
Definition: Stmt.h:1889
const Stmt * body_back() const
Definition: Stmt.h:1379
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:354
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:1663
static bool classof(const Stmt *T)
Definition: Stmt.h:1480
DoStmt(EmptyShell Empty)
Build an empty do-while statement.
Definition: Stmt.h:2354
Stmt * getHandler() const
Definition: Stmt.h:3301
SourceLocation getSemiLoc() const
Definition: Stmt.h:1296
StmtClass getStmtClass() const
Definition: Stmt.h:1097
SwitchCase * getNextSwitchCase()
Definition: Stmt.h:1464
bool isSingleDecl() const
Definition: DeclGroup.h:80
UnaryOperatorBitfields UnaryOperatorBits
Definition: Stmt.h:975
static bool classof(const Stmt *T)
Definition: Stmt.h:3263
SourceLocation getEndLoc() const
Definition: Stmt.h:2375
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:3556
void setEllipsisLoc(SourceLocation L)
Set the location of the ...
Definition: Stmt.h:1570
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
Definition: Stmt.h:1001
const Decl * getSingleDecl() const
Definition: Stmt.h:1228
static bool classof(const Stmt *T)
Definition: Stmt.h:3079
BreakStmt(EmptyShell Empty)
Build an empty break statement.
Definition: Stmt.h:2590
child_range children()
Definition: Stmt.h:2494
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Stmt.h:3552
const Stmt * getSubStmt() const
Definition: Stmt.h:1473
Stmt(StmtClass SC)
Definition: Stmt.h:1087
bool isSingleDecl() const
isSingleDecl - This method returns true if this DeclStmt refers to a single Decl. ...
Definition: Stmt.h:1226
body_iterator body_begin()
Definition: Stmt.h:1354
DeclStmt * getConditionVariableDeclStmt()
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
Definition: Stmt.h:1953
static bool classof(const Stmt *T)
Definition: Stmt.h:1241
IndirectGotoStmt(SourceLocation gotoLoc, SourceLocation starLoc, Expr *target)
Definition: Stmt.h:2509
const Stmt * getBody() const
Definition: Stmt.h:2100
CXXNewExprBitfields CXXNewExprBits
Definition: Stmt.h:998
llvm::iterator_range< const_body_iterator > body_const_range
Definition: Stmt.h:1363
Represents a __leave statement.
Definition: Stmt.h:3321
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
Definition: ExprCXX.h:3958
bool capturesVariableByCopy() const
Determine whether this capture handles a variable by copy.
Definition: Stmt.h:3404
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:2027
CXXConstructExprBitfields CXXConstructExprBits
Definition: Stmt.h:1002
Iterator for iterating over Stmt * arrays that contain only T *.
Definition: Stmt.h:1052
bool body_empty() const
Definition: Stmt.h:1347
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2437
SourceLocation getLeaveLoc() const
Definition: Stmt.h:3331
bool hasBraces() const
Definition: Stmt.h:3113
const_capture_init_iterator capture_init_end() const
Definition: Stmt.h:3548
void setRHS(Expr *Val)
Definition: Stmt.h:1601
void setVolatile(bool V)
Definition: Stmt.h:2740
friend TrailingObjects
Definition: OpenMPClause.h:98
static bool classof(const Stmt *T)
Definition: Stmt.h:1755
DefaultStmt(EmptyShell Empty)
Build an empty default statement.
Definition: Stmt.h:1652
reverse_decl_iterator decl_rend()
Definition: Stmt.h:1278
SourceLocation getBeginLoc() const
Definition: Stmt.h:2486
StringLiteral * getInputConstraintLiteral(unsigned i)
Definition: Stmt.h:2994
DeclGroupRef getDeclGroup()
Definition: Stmt.h:1232
Represents a &#39;co_await&#39; expression.
Definition: ExprCXX.h:4705
const Expr * getInputExpr(unsigned i) const
Definition: Stmt.h:3147
TypeTraitExprBitfields TypeTraitExprBits
Definition: Stmt.h:1000
void setSwitchLoc(SourceLocation L)
Definition: Stmt.h:2161
Stmt * getInit()
Definition: Stmt.h:2108
static bool classof(const Stmt *T)
Definition: Stmt.h:1667
decl_range decls()
Definition: Stmt.h:1261
CXXBoolLiteralExprBitfields CXXBoolLiteralExprBits
Definition: Stmt.h:991
void setBody(Stmt *Body)
Definition: Stmt.h:2365
AsmStringPiece(unsigned OpNo, const std::string &S, SourceLocation Begin, SourceLocation End)
Definition: Stmt.h:2914
bool IsSimple
True if the assembly statement does not have any input or output operands.
Definition: Stmt.h:2711
static bool classof(const Stmt *T)
Definition: Stmt.h:1816
StringRef getAsmString() const
Definition: Stmt.h:3119
ArrayRef< StringRef > getAllConstraints() const
Definition: Stmt.h:3153
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:2538
UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits
Definition: Stmt.h:976
SourceLocation getColonLoc() const
Definition: Stmt.h:1469
unsigned getNumClobbers() const
Definition: Stmt.h:2784
SourceLocation getRParenLoc() const
Definition: Stmt.h:2444
child_range children()
Definition: Stmt.h:2324
void setElseLoc(SourceLocation ElseLoc)
Definition: Stmt.h:1989
void setStarLoc(SourceLocation L)
Definition: Stmt.h:2521
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3390
SourceLocation getAsmLoc() const
Definition: Stmt.h:2733
outputs_range outputs()
Definition: Stmt.h:2836
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2465
A use of a default initializer in a constructor or in aggregate initialization.
Definition: ExprCXX.h:1279
Expr * getTarget()
Definition: Stmt.h:2524
Decl *const * const_iterator
Definition: DeclGroup.h:77
child_range children()
const SwitchCase * getNextSwitchCase() const
Definition: Stmt.h:1463
OverloadExprBitfields OverloadExprBits
Definition: Stmt.h:1006
void setCond(Expr *Cond)
Definition: Stmt.h:2361
SourceLocation getBeginLoc() const
Definition: Stmt.h:2595
Expr * getCond()
Definition: Stmt.h:2356
static bool classof(const Stmt *T)
Definition: Stmt.h:2377
const_child_range children() const
Definition: Stmt.h:3346
llvm::iterator_range< capture_iterator > capture_range
Definition: Stmt.h:3492
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2811
SourceLocation getWhileLoc() const
Definition: Stmt.h:2369
Defines the clang::SourceLocation class and associated facilities.
llvm::iterator_range< inputs_iterator > inputs_range
Definition: Stmt.h:2796
ContinueStmt - This represents a continue.
Definition: Stmt.h:2553
SourceLocation getBeginLoc() const
Definition: Stmt.h:1746
const_decl_iterator decl_end() const
Definition: Stmt.h:1270
const Expr * getRHS() const
Definition: Stmt.h:1595
reverse_body_iterator body_rbegin()
Definition: Stmt.h:1385
void setLBraceLoc(SourceLocation L)
Definition: Stmt.h:3109
child_range children()
Definition: Stmt.h:1246
CXXDefaultArgExprBitfields CXXDefaultArgExprBits
Definition: Stmt.h:995
Expr * getFilterExpr() const
Definition: Stmt.h:3212
SourceLocation getAttrLoc() const
Definition: Stmt.h:1799
ContinueStmt(SourceLocation CL)
Definition: Stmt.h:2555
const Stmt * getInit() const
Definition: Stmt.h:2430
OpenMPLinearClauseKind getModifier() const
Return modifier.
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:2210
CXXOperatorCallExprBitfields CXXOperatorCallExprBits
Definition: Stmt.h:989
llvm::iterator_range< capture_init_iterator > capture_init_range
Definition: Stmt.h:3517
SourceLocation AsmLoc
Definition: Stmt.h:2707
const_child_range children() const
Definition: Stmt.h:2386
labels_iterator begin_labels()
Definition: Stmt.h:3026
const_child_range children() const
Definition: Stmt.h:2577
static bool classof(const Stmt *T)
Definition: Stmt.h:2568
SourceLocation getBeginLoc() const
Definition: Stmt.h:2374
const Stmt * getSubStmt() const
Definition: Stmt.h:1608
void setDefaultLoc(SourceLocation L)
Definition: Stmt.h:1660
SourceLocation getBreakLoc() const
Definition: Stmt.h:2592
SourceLocation getCaseLoc() const
Definition: Stmt.h:1559
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of captures.
Definition: Stmt.h:3508
VariableCaptureKind
The different capture forms: by &#39;this&#39;, by reference, capture for variable-length array type etc...
Definition: Stmt.h:3364
void setElse(Stmt *Else)
Definition: Stmt.h:1928
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1686
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2521
static bool classof(const Stmt *T)
Definition: Stmt.h:2204
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:2743
void setRParenLoc(SourceLocation L)
Definition: Stmt.h:2445
SourceLocExprBitfields SourceLocExprBits
Definition: Stmt.h:986
NonOdrUseReason
The reason why a DeclRefExpr does not constitute an odr-use.
Definition: Specifiers.h:160
void setNextSwitchCase(SwitchCase *SC)
Definition: Stmt.h:1465
void initialize(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema)
const_child_range children() const
Definition: Stmt.h:2607
SourceLocation getBeginLoc() const
Definition: Stmt.h:2537
child_range children()
Definition: Stmt.h:2455
body_const_range body() const
Definition: Stmt.h:1365
A rewritten comparison expression that was originally written using operator syntax.
Definition: ExprCXX.h:273
capture_range captures()
Definition: Stmt.h:3495
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1146
SourceLocation getBeginLoc() const
Definition: Stmt.h:1477
void setLabel(LabelDecl *D)
Definition: Stmt.h:2479
SourceLocation getBeginLoc() const
Definition: Stmt.h:1424
static bool classof(const Stmt *T)
Definition: Stmt.h:1626
BreakStmt - This represents a break.
Definition: Stmt.h:2583
const Stmt * getInit() const
Definition: Stmt.h:1970
SourceLocation getBeginLoc() const
Definition: Stmt.h:1807
void setSubStmt(Stmt *SS)
Definition: Stmt.h:1744
CallExprBitfields CallExprBits
Definition: Stmt.h:978
CapturedRegionKind
The different kinds of captured statement.
Definition: CapturedStmt.h:16
unsigned getNumLabels() const
Definition: Stmt.h:3011
const Stmt * getBody() const
Definition: Stmt.h:2272
CastExprBitfields CastExprBits
Definition: Stmt.h:980
Stmt * getSubStmt()
Definition: Stmt.h:1741
DeclStmt(DeclGroupRef dg, SourceLocation startLoc, SourceLocation endLoc)
Definition: Stmt.h:1218
CXXNoexceptExprBitfields CXXNoexceptExprBits
Definition: Stmt.h:1009
const Expr * getCond() const
Definition: Stmt.h:1901
A trivial tuple used to represent a source range.
void setInit(Stmt *S)
Definition: Stmt.h:2435
unsigned NumInputs
Definition: Stmt.h:2718
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:645
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
Definition: Expr.h:2242
const_reverse_body_iterator body_rend() const
Definition: Stmt.h:1400
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Stmt.h:3077
const Expr * getCond() const
Definition: Stmt.h:2091
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument.
Definition: Stmt.h:3544
BinaryOperatorBitfields BinaryOperatorBits
Definition: Stmt.h:981
SourceLocation ColonLoc
Location of &#39;:&#39;.
Definition: OpenMPClause.h:107
const_child_range children() const
Definition: Stmt.h:1314
void setWhileLoc(SourceLocation L)
Definition: Stmt.h:2370
child_range children()
Definition: Stmt.h:2689
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ...
Definition: Stmt.h:1557
This class handles loading and caching of source files into memory.
BreakStmt(SourceLocation BL)
Definition: Stmt.h:2585
CompoundStmt * getTryBlock() const
Definition: Stmt.h:3297
Stmt * getSubStmt()
Definition: Stmt.h:1804
CompoundStmt * getBlock() const
Definition: Stmt.h:3216
void setKeywordLoc(SourceLocation L)
Definition: Stmt.h:1468
SourceLocation getReturnLoc() const
Definition: Stmt.h:2676
bool capturesVariableArrayType() const
Determine whether this capture handles a variable-length array type.
Definition: Stmt.h:3410
void setCond(Expr *Cond)
Definition: Stmt.h:1905
Attr - This represents one attribute.
Definition: Attr.h:45
void setLabelLoc(SourceLocation L)
Definition: Stmt.h:2484
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:1179
#define BLOCK(DERIVED, BASE)
Definition: Template.h:469
const Stmt * getStmtExprResult() const
Definition: Stmt.h:1420
SourceLocation getEndLoc() const
Definition: Stmt.h:3251
CXXDependentScopeMemberExprBitfields CXXDependentScopeMemberExprBits
Definition: Stmt.h:1005
const_capture_init_iterator capture_init_begin() const
Definition: Stmt.h:3538
SourceLocation getLocation() const
Retrieve the source location at which the variable or &#39;this&#39; was first used.
Definition: Stmt.h:3395
Stmt * getSubStmt()
Definition: Stmt.h:1607
const DeclStmt * getConditionVariableDeclStmt() const
Definition: Stmt.h:2150
inputs_iterator end_inputs()
Definition: Stmt.h:2803
outputs_const_range outputs() const
Definition: Stmt.h:2848
const LabelDecl * getConstantTarget() const
Definition: Stmt.h:2533