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