clang 10.0.0

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