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