clang 8.0.0

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