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