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