clang: include/clang/AST/Stmt.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_CLANG_AST_STMT_H
14#define LLVM_CLANG_AST_STMT_H
15
31#include "llvm/ADT/APFloat.h"
32#include "llvm/ADT/ArrayRef.h"
33#include "llvm/ADT/BitmaskEnum.h"
34#include "llvm/ADT/PointerIntPair.h"
35#include "llvm/ADT/StringRef.h"
36#include "llvm/ADT/iterator.h"
37#include "llvm/ADT/iterator_range.h"
38#include "llvm/Support/Casting.h"
39#include "llvm/Support/Compiler.h"
40#include "llvm/Support/ErrorHandling.h"
41#include
42#include
43#include
44#include
45#include
46#include
47
48namespace llvm {
49
50class FoldingSetNodeID;
51
52}
53
55
78
79
80
81
82
83
84
85class alignas(void *) Stmt {
86public:
89#define STMT(CLASS, PARENT) CLASS##Class,
90#define STMT_RANGE(BASE, FIRST, LAST) \
91 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class,
92#define LAST_STMT_RANGE(BASE, FIRST, LAST) \
93 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class
94#define ABSTRACT_STMT(STMT)
95#include "clang/AST/StmtNodes.inc"
96 };
97
98
99protected:
102
103 void *operator new(size_t bytes) noexcept {
104 llvm_unreachable("Stmts cannot be allocated with regular 'new'.");
105 }
106
107 void operator delete(void *data) noexcept {
108 llvm_unreachable("Stmts cannot be released with regular 'delete'.");
109 }
110
111
112
113 #define NumStmtBits 9
114
124
129
132
133
134
135
136
137
138 LLVM_PREFERRED_TYPE(bool)
139 unsigned HasLeadingEmptyMacro : 1;
140
141
143 };
144
148
151
152
153
154 LLVM_PREFERRED_TYPE(bool)
155 unsigned HasFPFeatures : 1;
156
157 unsigned NumStmts;
158 };
159
168
172
175
176
178
179
181 };
182
186
189
190
192 unsigned Kind : 3;
193
194
195 LLVM_PREFERRED_TYPE(bool)
196 unsigned HasElse : 1;
197
198
199 LLVM_PREFERRED_TYPE(bool)
200 unsigned HasVar : 1;
201
202
203 LLVM_PREFERRED_TYPE(bool)
204 unsigned HasInit : 1;
205
206
208 };
209
212
215
216
217 LLVM_PREFERRED_TYPE(bool)
218 unsigned HasInit : 1;
219
220
221 LLVM_PREFERRED_TYPE(bool)
222 unsigned HasVar : 1;
223
224
225
226
227 LLVM_PREFERRED_TYPE(bool)
228 unsigned AllEnumCasesCovered : 1;
229
230
232 };
233
237
240
241
242 LLVM_PREFERRED_TYPE(bool)
243 unsigned HasVar : 1;
244
245
247 };
248
258
268
279
289
292
295
296
297 LLVM_PREFERRED_TYPE(bool)
298 unsigned HasNRVOCandidate : 1;
299
300
302 };
303
307
310
311
312
313 LLVM_PREFERRED_TYPE(bool)
314 unsigned CaseStmtIsGNURange : 1;
315
316
318 };
319
329
330
331
355
358
360 unsigned ValueKind : 2;
362 unsigned ObjectKind : 3;
364 unsigned Dependent : llvm::BitWidth;
365 };
367
372
375
376
378 unsigned ResultKind : 2;
379
380
382 unsigned APValueKind : 4;
383
384
385
386 LLVM_PREFERRED_TYPE(bool)
387 unsigned IsUnsigned : 1;
388
389
390
391
392
393 unsigned BitWidth : 7;
394
395
396
397 LLVM_PREFERRED_TYPE(bool)
398 unsigned HasCleanup : 1;
399
400
401 LLVM_PREFERRED_TYPE(bool)
402 unsigned IsImmediateInvocation : 1;
403 };
404
408
411
413 unsigned Kind : 4;
414
415
416
417 LLVM_PREFERRED_TYPE(bool)
418 unsigned HasFunctionName : 1;
419
420
421
422 LLVM_PREFERRED_TYPE(bool)
423 unsigned IsTransparent : 1;
424
425
427 };
428
432
435
436 LLVM_PREFERRED_TYPE(bool)
437 unsigned HasQualifier : 1;
438 LLVM_PREFERRED_TYPE(bool)
439 unsigned HasTemplateKWAndArgsInfo : 1;
440 LLVM_PREFERRED_TYPE(bool)
441 unsigned HasFoundDecl : 1;
442 LLVM_PREFERRED_TYPE(bool)
443 unsigned HadMultipleCandidates : 1;
444 LLVM_PREFERRED_TYPE(bool)
445 unsigned RefersToEnclosingVariableOrCapture : 1;
446 LLVM_PREFERRED_TYPE(bool)
447 unsigned CapturedByCopyInLambdaWithExplicitObjectParameter : 1;
448 LLVM_PREFERRED_TYPE(NonOdrUseReason)
449 unsigned NonOdrUseReason : 2;
450 LLVM_PREFERRED_TYPE(bool)
451 unsigned IsImmediateEscalating : 1;
452
453
455 };
456
457
460
463
464 static_assert(
465 llvm::APFloat::S_MaxSemantics < 32,
466 "Too many Semantics enum values to fit in bitfield of size 5");
467 LLVM_PREFERRED_TYPE(llvm::APFloat::Semantics)
468 unsigned Semantics : 5;
469 LLVM_PREFERRED_TYPE(bool)
470 unsigned IsExact : 1;
471 };
472
476
479
480
481
483 unsigned Kind : 3;
484
485
486
487
488 unsigned CharByteWidth : 3;
489
490 LLVM_PREFERRED_TYPE(bool)
491 unsigned IsPascal : 1;
492
493
494
495 unsigned NumConcatenated;
496 };
497
500
503
505 unsigned Kind : 3;
506 };
507
510
513
515 unsigned Opc : 5;
516 LLVM_PREFERRED_TYPE(bool)
517 unsigned CanOverflow : 1;
518
519
520
521
522 LLVM_PREFERRED_TYPE(bool)
523 unsigned HasFPFeatures : 1;
524
526 };
527
530
533
535 unsigned Kind : 4;
536 LLVM_PREFERRED_TYPE(bool)
537 unsigned IsType : 1;
538 };
539
550
553
556
557 unsigned NumPreArgs : 1;
558
559
560 LLVM_PREFERRED_TYPE(bool)
561 unsigned UsesADL : 1;
562
563
564 LLVM_PREFERRED_TYPE(bool)
565 unsigned HasFPFeatures : 1;
566
567
568 LLVM_PREFERRED_TYPE(bool)
569 unsigned IsCoroElideSafe : 1;
570
571
572
573 LLVM_PREFERRED_TYPE(bool)
574 unsigned ExplicitObjectMemFunUsingMemberSyntax : 1;
575
576
577
578 LLVM_PREFERRED_TYPE(bool)
579 unsigned HasTrailingSourceLoc : 1;
580 };
581
583
587
590
591
592 LLVM_PREFERRED_TYPE(bool)
593 unsigned IsArrow : 1;
594
595
596
597 LLVM_PREFERRED_TYPE(bool)
598 unsigned HasQualifier : 1;
599
600
601 LLVM_PREFERRED_TYPE(bool)
602 unsigned HasFoundDecl : 1;
603
604
605
606
607
608
609 LLVM_PREFERRED_TYPE(bool)
610 unsigned HasTemplateKWAndArgsInfo : 1;
611
612
613
614 LLVM_PREFERRED_TYPE(bool)
615 unsigned HadMultipleCandidates : 1;
616
617
618
619
620 LLVM_PREFERRED_TYPE(NonOdrUseReason)
621 unsigned NonOdrUseReason : 2;
622
623
625 };
626
630
633
634 LLVM_PREFERRED_TYPE(CastKind)
635 unsigned Kind : 7;
636 LLVM_PREFERRED_TYPE(bool)
637 unsigned PartOfExplicitCast : 1;
638
639
640 LLVM_PREFERRED_TYPE(bool)
641 unsigned HasFPFeatures : 1;
642
643
644
645 unsigned BasePathSize;
646 };
647
650
653
655 unsigned Opc : 6;
656
657
658
659
660 LLVM_PREFERRED_TYPE(bool)
661 unsigned HasFPFeatures : 1;
662
663
664
665 LLVM_PREFERRED_TYPE(bool)
666 unsigned ExcludedOverflowPattern : 1;
667
669 };
670
673
676
677
678
679 LLVM_PREFERRED_TYPE(bool)
680 unsigned HadArrayRangeDesignator : 1;
681 };
682
686
689
690
691 unsigned NumExprs;
692 };
693
704
708
711
712 unsigned NumSubExprs : 16;
713 unsigned ResultIndex : 16;
714 };
715
719
722
723
724
726 unsigned Kind : 3;
727 };
728
733
736
737 LLVM_PREFERRED_TYPE(bool)
738 unsigned ProducedByFoldExpansion : 1;
739 };
740
743
746
747 unsigned NumExprs;
748 };
749
753
756
757
758
759
760 unsigned TemplateDepth;
761 };
762
766
769
770 LLVM_PREFERRED_TYPE(bool)
771 bool CondIsTrue : 1;
772 };
773
774
775
779
782
783
784
786 unsigned OperatorKind : 6;
787 };
788
792
795
796 LLVM_PREFERRED_TYPE(bool)
797 unsigned IsReversed : 1;
798 };
799
802
805
806
807 LLVM_PREFERRED_TYPE(bool)
808 unsigned Value : 1;
809
810
812 };
813
823
826
829
830
831 LLVM_PREFERRED_TYPE(bool)
832 unsigned IsImplicit : 1;
833
834
835
836 LLVM_PREFERRED_TYPE(bool)
837 unsigned CapturedByCopyInLambdaWithExplicitObjectParameter : 1;
838
839
841 };
842
846
849
850
851 LLVM_PREFERRED_TYPE(bool)
852 unsigned IsThrownVariableInScope : 1;
853
854
856 };
857
861
864
865
866 LLVM_PREFERRED_TYPE(bool)
867 unsigned HasRewrittenInit : 1;
868
869
871 };
872
876
879
880
881
882 LLVM_PREFERRED_TYPE(bool)
883 unsigned HasRewrittenInit : 1;
884
885
887 };
888
898
903
906
907
908 LLVM_PREFERRED_TYPE(bool)
909 unsigned IsGlobalNew : 1;
910
911
912
913 LLVM_PREFERRED_TYPE(bool)
914 unsigned IsArray : 1;
915
916
917 LLVM_PREFERRED_TYPE(bool)
918 unsigned ShouldPassAlignment : 1;
919
920
921 LLVM_PREFERRED_TYPE(bool)
922 unsigned ShouldPassTypeIdentity : 1;
923
924
925
926 LLVM_PREFERRED_TYPE(bool)
927 unsigned UsualArrayDeleteWantsSize : 1;
928
929
930 LLVM_PREFERRED_TYPE(bool)
931 unsigned HasInitializer : 1;
932
933
935 unsigned StoredInitializationStyle : 2;
936
937
938 LLVM_PREFERRED_TYPE(bool)
939 unsigned IsParenTypeId : 1;
940
941
942 unsigned NumPlacementArgs;
943 };
944
948
951
952
953 LLVM_PREFERRED_TYPE(bool)
954 unsigned GlobalDelete : 1;
955
956
957 LLVM_PREFERRED_TYPE(bool)
958 unsigned ArrayForm : 1;
959
960
961
962
963 LLVM_PREFERRED_TYPE(bool)
964 unsigned ArrayFormAsWritten : 1;
965
966
967
968 LLVM_PREFERRED_TYPE(bool)
969 unsigned UsualArrayDeleteWantsSize : 1;
970
971
973 };
974
979
982
983
985 unsigned Kind : 8;
986
987 LLVM_PREFERRED_TYPE(bool)
988 unsigned IsBooleanTypeTrait : 1;
989
990
991
992 LLVM_PREFERRED_TYPE(bool)
993 unsigned Value : 1;
994
995
996
997 unsigned NumArgs;
998 };
999
1004
1007
1008
1009
1010 LLVM_PREFERRED_TYPE(bool)
1011 unsigned HasTemplateKWAndArgsInfo : 1;
1012 };
1013
1017
1020
1021 LLVM_PREFERRED_TYPE(bool)
1022 unsigned Elidable : 1;
1023 LLVM_PREFERRED_TYPE(bool)
1024 unsigned HadMultipleCandidates : 1;
1025 LLVM_PREFERRED_TYPE(bool)
1026 unsigned ListInitialization : 1;
1027 LLVM_PREFERRED_TYPE(bool)
1028 unsigned StdInitListInitialization : 1;
1029 LLVM_PREFERRED_TYPE(bool)
1030 unsigned ZeroInitialization : 1;
1032 unsigned ConstructionKind : 3;
1033 LLVM_PREFERRED_TYPE(bool)
1034 unsigned IsImmediateEscalating : 1;
1035
1037 };
1038
1042
1045
1046
1047 LLVM_PREFERRED_TYPE(bool)
1048 unsigned CleanupsHaveSideEffects : 1;
1049
1050 unsigned NumObjects : 32 - 1 - NumExprBits;
1051 };
1052
1056
1059
1060
1061 unsigned NumArgs;
1062 };
1063
1067
1070
1071
1072
1073 LLVM_PREFERRED_TYPE(bool)
1074 unsigned IsArrow : 1;
1075
1076
1077
1078 LLVM_PREFERRED_TYPE(bool)
1079 unsigned HasTemplateKWAndArgsInfo : 1;
1080
1081
1082
1083 LLVM_PREFERRED_TYPE(bool)
1084 unsigned HasFirstQualifierFoundInScope : 1;
1085
1086
1088 };
1089
1093
1096
1097
1098
1099 LLVM_PREFERRED_TYPE(bool)
1100 unsigned HasTemplateKWAndArgsInfo : 1;
1101
1102
1103
1104
1106
1107
1108 unsigned NumResults;
1109 };
1111
1115
1118
1119
1120
1121 LLVM_PREFERRED_TYPE(bool)
1122 unsigned RequiresADL : 1;
1123 };
1125 "UnresolvedLookupExprBitfields must be <= than 4 bytes to"
1126 "avoid trashing OverloadExprBitfields::NumResults!");
1127
1131
1134
1135
1136
1137 LLVM_PREFERRED_TYPE(bool)
1138 unsigned IsArrow : 1;
1139
1140
1141 LLVM_PREFERRED_TYPE(bool)
1142 unsigned HasUnresolvedUsing : 1;
1143 };
1145 "UnresolvedMemberExprBitfields must be <= than 4 bytes to"
1146 "avoid trashing OverloadExprBitfields::NumResults!");
1147
1151
1154
1155 LLVM_PREFERRED_TYPE(bool)
1156 unsigned Value : 1;
1157 };
1158
1169
1174
1177
1178
1179
1181 unsigned CaptureDefault : 2;
1182
1183
1184
1185 LLVM_PREFERRED_TYPE(bool)
1186 unsigned ExplicitParams : 1;
1187
1188
1189 LLVM_PREFERRED_TYPE(bool)
1190 unsigned ExplicitResultType : 1;
1191
1192
1193 unsigned NumCaptures : 16;
1194 };
1195
1200
1203
1204 LLVM_PREFERRED_TYPE(bool)
1205 unsigned IsSatisfied : 1;
1207 };
1208
1214
1215
1217 unsigned ATT : 2;
1218 };
1219
1225
1226
1228 unsigned ET : 31;
1229
1230
1231 LLVM_PREFERRED_TYPE(bool)
1232 unsigned Value : 1;
1233 };
1234
1245
1250
1253
1254 unsigned TransformedExpressions : 31;
1255
1256 LLVM_PREFERRED_TYPE(bool)
1257 unsigned FullySubstituted : 1;
1258 };
1259
1260
1261
1264
1267
1268 LLVM_PREFERRED_TYPE(bool)
1269 unsigned IsImplicit : 1;
1270 };
1271
1272
1273
1276
1279
1280 LLVM_PREFERRED_TYPE(bool)
1281 unsigned ShouldCopy : 1;
1282 };
1283
1284
1285
1289
1292
1293
1294
1295 LLVM_PREFERRED_TYPE(bool)
1296 unsigned IsUnique : 1;
1297
1299 };
1300
1303
1306
1307
1308
1309
1310
1311 LLVM_PREFERRED_TYPE(bool)
1312 unsigned HasFPFeatures : 1;
1313 };
1314
1315 union {
1316
1317
1333
1334
1356
1357
1360
1361
1390
1391
1393
1394
1396
1397
1400 };
1401
1402public:
1403
1404
1406 unsigned alignment = 8);
1407
1409 unsigned alignment = 8) {
1410 return operator new(bytes, *C, alignment);
1411 }
1412
1413 void *operator new(size_t bytes, void *mem) noexcept { return mem; }
1414
1417 void operator delete(void *, size_t) noexcept {}
1418 void operator delete(void *, void *) noexcept {}
1419
1420public:
1421
1422
1423
1425
1426
1433
1434protected:
1435
1436
1437
1438
1439 template<typename T, typename TPtr = T *, typename StmtPtr = Stmt *>
1441 : llvm::iterator_adaptor_base<CastIterator<T, TPtr, StmtPtr>, StmtPtr *,
1442 std::random_access_iterator_tag, TPtr> {
1443 using Base = typename CastIterator::iterator_adaptor_base;
1444
1447
1449 return cast_or_null(*this->I);
1450 }
1451 };
1452
1453
1454 template
1456
1459
1460private:
1461
1462 static bool StatisticsEnabled;
1463
1464protected:
1465
1467
1468public:
1474
1476 static_assert(sizeof(*this) <= 8,
1477 "changing bitfields changed sizeof(Stmt)");
1478 static_assert(sizeof(*this) % alignof(void *) == 0,
1479 "Insufficient alignment!");
1482 }
1483
1487
1489
1490
1491
1492
1496
1497
1501
1502
1504
1505
1507
1508
1510
1511
1512
1513
1515
1516
1517
1518
1519 static std::tuple<bool, const Attr *, const Attr *>
1521
1522
1523
1524 void dump() const;
1525 void dump(raw_ostream &OS, const ASTContext &Context) const;
1526
1527
1529
1530
1532
1533
1534
1537 const PrintingPolicy &Policy, unsigned Indentation = 0,
1538 StringRef NewlineSymbol = "\n",
1539 const ASTContext *Context = nullptr) const;
1542 unsigned Indentation = 0,
1543 StringRef NewlineSymbol = "\n",
1544 const ASTContext *Context = nullptr) const;
1545
1546
1548 const PrintingPolicy &Policy, bool AddQuotes) const;
1549
1550
1551
1553
1554
1555
1558 return const_cast<Stmt *>(this)->IgnoreContainers(IgnoreCaptured);
1559 }
1560
1563 return const_cast<Stmt*>(
1564 const_cast<const Stmt*>(this)->stripLabelLikeStatements());
1565 }
1566
1567
1568
1569
1572
1573 using child_range = llvm::iterator_range<child_iterator>;
1575
1577
1581
1584
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605 void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
1606 bool Canonical, bool ProfileLambdaExpr = false) const;
1607
1608
1609
1610
1611
1612
1613
1614
1616};
1617
1618
1619
1620
1621
1625
1626public:
1628 : Stmt(DeclStmtClass), DG(dg), StartLoc(startLoc), EndLoc(endLoc) {}
1629
1630
1632
1633
1634
1636
1639
1643
1647
1649
1651 return T->getStmtClass() == DeclStmtClass;
1652 }
1653
1654
1659
1664
1667 using decl_range = llvm::iterator_range<decl_iterator>;
1669
1671
1675
1680
1682
1686
1690};
1691
1692
1693
1695public:
1697 : Stmt(NullStmtClass) {
1700 }
1701
1702
1704
1707
1711
1714
1716 return T->getStmtClass() == NullStmtClass;
1717 }
1718
1722
1726};
1727
1728
1729class CompoundStmt final
1730 : public Stmt,
1731 private llvm::TrailingObjects<CompoundStmt, Stmt *, FPOptionsOverride> {
1733 friend TrailingObjects;
1734
1735
1737
1738
1740
1744
1746
1747
1750 *getTrailingObjects() = F;
1751 }
1752
1753 size_t numTrailingObjects(OverloadToken<Stmt *>) const {
1755 }
1756
1757public:
1758 static CompoundStmt *Create(const ASTContext &C, ArrayRef<Stmt *> Stmts,
1759 FPOptionsOverride FPFeatures, SourceLocation LB,
1760 SourceLocation RB);
1761
1762
1764
1766 : Stmt(CompoundStmtClass), LBraceLoc(Loc), RBraceLoc(EndLoc) {
1769 }
1770
1771
1773 bool HasFPFeatures);
1774
1777
1779
1780
1783 return *getTrailingObjects();
1784 }
1785
1786
1790
1792 using body_range = llvm::iterator_range<body_iterator>;
1793
1798
1802
1805
1809
1811 return getTrailingObjects<Stmt *>();
1812 }
1813
1815
1819
1823
1825
1829
1833
1835 std::reverse_iterator<const_body_iterator>;
1836
1840
1844
1847
1850
1852 return T->getStmtClass() == CompoundStmtClass;
1853 }
1854
1855
1857
1861};
1862
1863
1865protected:
1866
1868
1869
1870
1871
1872
1873
1875
1880
1882
1883public:
1887
1892
1897
1900
1902 return T->getStmtClass() == CaseStmtClass ||
1903 T->getStmtClass() == DefaultStmtClass;
1904 }
1905};
1906
1907
1908
1909class CaseStmt final
1911 private llvm::TrailingObjects<CaseStmt, Stmt *, SourceLocation> {
1912 friend TrailingObjects;
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929 enum { LhsOffset = 0, SubStmtOffsetFromRhs = 1 };
1930 enum { NumMandatoryStmtPtr = 2 };
1931
1932 unsigned numTrailingObjects(OverloadToken<Stmt *>) const {
1934 }
1935
1936 unsigned lhsOffset() const { return LhsOffset; }
1937 unsigned rhsOffset() const { return LhsOffset + caseStmtIsGNURange(); }
1938 unsigned subStmtOffset() const { return rhsOffset() + SubStmtOffsetFromRhs; }
1939
1940
1941
1944 : SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
1945
1946 bool IsGNURange = rhs != nullptr;
1950 if (IsGNURange) {
1953 }
1954 }
1955
1956
1957 explicit CaseStmt(EmptyShell Empty, bool CaseStmtIsGNURange)
1959 SwitchCaseBits.CaseStmtIsGNURange = CaseStmtIsGNURange;
1960 }
1961
1962public:
1963
1967
1968
1970
1971
1972
1973
1975
1978
1979
1984
1985
1986
1988 assert(
1990 "setEllipsisLoc but this is not a case stmt of the form LHS ... RHS!");
1991 *getTrailingObjects() = L;
1992 }
1993
1995 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1996 }
1997
1999 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[lhsOffset()]);
2000 }
2001
2003 getTrailingObjects<Stmt *>()[lhsOffset()] = reinterpret_cast<Stmt *>(Val);
2004 }
2005
2008 getTrailingObjects<Stmt *>()[rhsOffset()])
2009 : nullptr;
2010 }
2011
2014 getTrailingObjects<Stmt *>()[rhsOffset()])
2015 : nullptr;
2016 }
2017
2020 "setRHS but this is not a case stmt of the form LHS ... RHS!");
2021 getTrailingObjects<Stmt *>()[rhsOffset()] = reinterpret_cast<Stmt *>(Val);
2022 }
2023
2024 Stmt *getSubStmt() { return getTrailingObjects<Stmt *>()[subStmtOffset()]; }
2026 return getTrailingObjects<Stmt *>()[subStmtOffset()];
2027 }
2028
2030 getTrailingObjects<Stmt *>()[subStmtOffset()] = S;
2031 }
2032
2035
2036 const CaseStmt *CS = this;
2037 while (const auto *CS2 = dyn_cast(CS->getSubStmt()))
2038 CS = CS2;
2039
2041 }
2042
2044 return T->getStmtClass() == CaseStmtClass;
2045 }
2046
2047
2049 return child_range(getTrailingObjects<Stmt *>(),
2050 getTrailingObjects<Stmt *>() +
2051 numTrailingObjects(OverloadToken<Stmt *>()));
2052 }
2053
2056 getTrailingObjects<Stmt *>() +
2057 numTrailingObjects(OverloadToken<Stmt *>()));
2058 }
2059};
2060
2062 Stmt *SubStmt;
2063
2064public:
2066 : SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {}
2067
2068
2071
2075
2078
2081 return SubStmt->getEndLoc();
2082 }
2083
2085 return T->getStmtClass() == DefaultStmtClass;
2086 }
2087
2088
2090
2094};
2095
2097 if (const auto *CS = dyn_cast(this))
2098 return CS->getEndLoc();
2099 else if (const auto *DS = dyn_cast(this))
2100 return DS->getEndLoc();
2101 llvm_unreachable("SwitchCase is neither a CaseStmt nor a DefaultStmt!");
2102}
2103
2105 if (auto *CS = dyn_cast(this))
2106 return CS->getSubStmt();
2107 else if (auto *DS = dyn_cast(this))
2108 return DS->getSubStmt();
2109 llvm_unreachable("SwitchCase is neither a CaseStmt nor a DefaultStmt!");
2110}
2111
2112
2113
2114
2115
2116
2117
2119protected:
2121
2122public:
2125 const ValueStmt *ConstThis = this;
2127 }
2128
2130 return T->getStmtClass() >= firstValueStmtConstant &&
2131 T->getStmtClass() <= lastValueStmtConstant;
2132 }
2133};
2134
2135
2136
2139 Stmt *SubStmt;
2140 bool SideEntry = false;
2141
2142public:
2143
2145 : ValueStmt(LabelStmtClass), TheDecl(D), SubStmt(substmt) {
2147 }
2148
2149
2151
2154
2157
2158 const char *getName() const;
2160
2163
2166
2167
2168
2171 return const_cast<Stmt *>(
2172 const_cast<const LabelStmt *>(this)->getInnermostLabeledStmt());
2173 }
2174
2176
2180
2182 return T->getStmtClass() == LabelStmtClass;
2183 }
2186};
2187
2188
2189
2190
2191
2192class AttributedStmt final
2194 private llvm::TrailingObjects<AttributedStmt, const Attr *> {
2196 friend TrailingObjects;
2197
2198 Stmt *SubStmt;
2199
2201 Stmt *SubStmt)
2202 : ValueStmt(AttributedStmtClass), SubStmt(SubStmt) {
2205 llvm::copy(Attrs, getAttrArrayPtr());
2206 }
2207
2212 std::fill_n(getAttrArrayPtr(), NumAttrs, nullptr);
2213 }
2214
2215 const Attr *const *getAttrArrayPtr() const { return getTrailingObjects(); }
2216 const Attr **getAttrArrayPtr() { return getTrailingObjects(); }
2217
2218public:
2219 static AttributedStmt *Create(const ASTContext &C, SourceLocation Loc,
2220 ArrayRef<const Attr *> Attrs, Stmt *SubStmt);
2221
2222
2223 static AttributedStmt *CreateEmpty(const ASTContext &C, unsigned NumAttrs);
2224
2229
2232
2235
2237
2241
2243 return T->getStmtClass() == AttributedStmtClass;
2244 }
2245};
2246
2247
2248class IfStmt final
2249 : public Stmt,
2250 private llvm::TrailingObjects<IfStmt, Stmt *, SourceLocation> {
2251 friend TrailingObjects;
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275 enum { InitOffset = 0, ThenOffsetFromCond = 1, ElseOffsetFromCond = 2 };
2276 enum { NumMandatoryStmtPtr = 2 };
2279
2280 unsigned numTrailingObjects(OverloadToken<Stmt *>) const {
2283 }
2284
2285 unsigned numTrailingObjects(OverloadToken) const {
2287 }
2288
2289 unsigned initOffset() const { return InitOffset; }
2290 unsigned varOffset() const { return InitOffset + hasInitStorage(); }
2291 unsigned condOffset() const {
2293 }
2294 unsigned thenOffset() const { return condOffset() + ThenOffsetFromCond; }
2295 unsigned elseOffset() const { return condOffset() + ElseOffsetFromCond; }
2296
2297
2301
2302
2303 explicit IfStmt(EmptyShell Empty, bool HasElse, bool HasVar, bool HasInit);
2304
2305public:
2306
2311 Stmt *Else = nullptr);
2312
2313
2314
2316 bool HasInit);
2317
2318
2320
2321
2323
2324
2326
2328 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
2329 }
2330
2332 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
2333 }
2334
2336 getTrailingObjects<Stmt *>()[condOffset()] = reinterpret_cast<Stmt *>(Cond);
2337 }
2338
2339 Stmt *getThen() { return getTrailingObjects<Stmt *>()[thenOffset()]; }
2341 return getTrailingObjects<Stmt *>()[thenOffset()];
2342 }
2343
2345 getTrailingObjects<Stmt *>()[thenOffset()] = Then;
2346 }
2347
2349 return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
2350 : nullptr;
2351 }
2352
2354 return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
2355 : nullptr;
2356 }
2357
2360 "This if statement has no storage for an else statement!");
2361 getTrailingObjects<Stmt *>()[elseOffset()] = Else;
2362 }
2363
2364
2365
2366
2367
2368
2369
2370
2371
2376
2377
2378
2380
2381
2382
2385 getTrailingObjects<Stmt *>()[varOffset()])
2386 : nullptr;
2387 }
2388
2391 getTrailingObjects<Stmt *>()[varOffset()])
2392 : nullptr;
2393 }
2394
2397 getTrailingObjects<Stmt *>()[varOffset()] = CondVar;
2398 }
2399
2401 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2402 : nullptr;
2403 }
2404
2406 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2407 : nullptr;
2408 }
2409
2412 "This if statement has no storage for an init statement!");
2413 getTrailingObjects<Stmt *>()[initOffset()] = Init;
2414 }
2415
2418
2420 return hasElseStorage() ? *getTrailingObjects()
2422 }
2423
2426 "This if statement has no storage for an else statement!");
2427 *getTrailingObjects() = ElseLoc;
2428 }
2429
2434
2438
2442
2446
2448 IfStmtBits.Kind = static_cast<unsigned>(Kind);
2449 }
2450
2454
2455
2456
2459
2461
2472
2473
2474
2476
2477
2478 return child_range(getTrailingObjects<Stmt *>() +
2480 getTrailingObjects<Stmt *>() +
2481 numTrailingObjects(OverloadToken<Stmt *>()));
2482 }
2483
2485
2486
2489 getTrailingObjects<Stmt *>() +
2490 numTrailingObjects(OverloadToken<Stmt *>()));
2491 }
2492
2494 return T->getStmtClass() == IfStmtClass;
2495 }
2496};
2497
2498
2499class SwitchStmt final : public Stmt,
2500 private llvm::TrailingObjects<SwitchStmt, Stmt *> {
2501 friend TrailingObjects;
2502
2503
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523 enum { InitOffset = 0, BodyOffsetFromCond = 1 };
2524 enum { NumMandatoryStmtPtr = 2 };
2527
2528 unsigned numTrailingStatements() const {
2530 }
2531
2532 unsigned initOffset() const { return InitOffset; }
2533 unsigned varOffset() const { return InitOffset + hasInitStorage(); }
2534 unsigned condOffset() const {
2536 }
2537 unsigned bodyOffset() const { return condOffset() + BodyOffsetFromCond; }
2538
2539
2542
2543
2544 explicit SwitchStmt(EmptyShell Empty, bool HasInit, bool HasVar);
2545
2546public:
2547
2551
2552
2553
2555 bool HasVar);
2556
2557
2559
2560
2562
2564 return reinterpret_cast<Expr *>(getTrailingObjects()[condOffset()]);
2565 }
2566
2568 return reinterpret_cast<Expr *>(getTrailingObjects()[condOffset()]);
2569 }
2570
2572 getTrailingObjects()[condOffset()] = reinterpret_cast<Stmt *>(Cond);
2573 }
2574
2575 Stmt *getBody() { return getTrailingObjects()[bodyOffset()]; }
2576 const Stmt *getBody() const { return getTrailingObjects()[bodyOffset()]; }
2577
2578 void setBody(Stmt *Body) { getTrailingObjects()[bodyOffset()] = Body; }
2579
2581 return hasInitStorage() ? getTrailingObjects()[initOffset()] : nullptr;
2582 }
2583
2585 return hasInitStorage() ? getTrailingObjects()[initOffset()] : nullptr;
2586 }
2587
2590 "This switch statement has no storage for an init statement!");
2591 getTrailingObjects()[initOffset()] = Init;
2592 }
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2607
2608
2609
2611
2612
2613
2616 ? static_cast<DeclStmt *>(getTrailingObjects()[varOffset()])
2617 : nullptr;
2618 }
2619
2622 ? static_cast<DeclStmt *>(getTrailingObjects()[varOffset()])
2623 : nullptr;
2624 }
2625
2628 getTrailingObjects()[varOffset()] = CondVar;
2629 }
2630
2634
2641
2646
2649 "case/default already added to a switch");
2651 FirstCase = SC;
2652 }
2653
2654
2655
2657
2658
2659
2663
2669
2670
2672 return child_range(getTrailingObjects(),
2673 getTrailingObjects() + numTrailingStatements());
2674 }
2675
2678 getTrailingObjects() + numTrailingStatements());
2679 }
2680
2682 return T->getStmtClass() == SwitchStmtClass;
2683 }
2684};
2685
2686
2687class WhileStmt final : public Stmt,
2688 private llvm::TrailingObjects<WhileStmt, Stmt *> {
2689 friend TrailingObjects;
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706 enum { VarOffset = 0, BodyOffsetFromCond = 1 };
2707 enum { NumMandatoryStmtPtr = 2 };
2708
2710
2711 unsigned varOffset() const { return VarOffset; }
2712 unsigned condOffset() const { return VarOffset + hasVarStorage(); }
2713 unsigned bodyOffset() const { return condOffset() + BodyOffsetFromCond; }
2714
2715 unsigned numTrailingStatements() const {
2717 }
2718
2719
2723
2724
2726
2727public:
2728
2732
2733
2734
2736
2737
2739
2741 return reinterpret_cast<Expr *>(getTrailingObjects()[condOffset()]);
2742 }
2743
2745 return reinterpret_cast<Expr *>(getTrailingObjects()[condOffset()]);
2746 }
2747
2749 getTrailingObjects()[condOffset()] = reinterpret_cast<Stmt *>(Cond);
2750 }
2751
2752 Stmt *getBody() { return getTrailingObjects()[bodyOffset()]; }
2753 const Stmt *getBody() const { return getTrailingObjects()[bodyOffset()]; }
2754
2755 void setBody(Stmt *Body) { getTrailingObjects()[bodyOffset()] = Body; }
2756
2757
2758
2759
2760
2761
2762
2763
2764
2769
2770
2771
2773
2774
2775
2778 ? static_cast<DeclStmt *>(getTrailingObjects()[varOffset()])
2779 : nullptr;
2780 }
2781
2784 ? static_cast<DeclStmt *>(getTrailingObjects()[varOffset()])
2785 : nullptr;
2786 }
2787
2790 getTrailingObjects()[varOffset()] = CondVar;
2791 }
2792
2795
2800
2805
2807 return T->getStmtClass() == WhileStmtClass;
2808 }
2809
2810
2812 return child_range(getTrailingObjects(),
2813 getTrailingObjects() + numTrailingStatements());
2814 }
2815
2818 getTrailingObjects() + numTrailingStatements());
2819 }
2820};
2821
2822
2824 enum { BODY, COND, END_EXPR };
2825 Stmt *SubExprs[END_EXPR];
2827 SourceLocation RParenLoc;
2828
2829public:
2832 : Stmt(DoStmtClass), WhileLoc(WL), RParenLoc(RP) {
2836 }
2837
2838
2840
2843 return reinterpret_cast<Expr *>(SubExprs[COND]);
2844 }
2845
2847
2851
2858
2861
2863 return T->getStmtClass() == DoStmtClass;
2864 }
2865
2866
2868 return child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2869 }
2870
2874};
2875
2876
2877
2878
2881
2882 enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
2883 Stmt* SubExprs[END_EXPR];
2885
2886public:
2890
2891
2893
2895
2896
2897
2898
2899
2900
2901
2902
2903
2906
2907
2908
2910 return reinterpret_cast<DeclStmt*>(SubExprs[CONDVAR]);
2911 }
2912
2914 return reinterpret_cast<DeclStmt*>(SubExprs[CONDVAR]);
2915 }
2916
2918 SubExprs[CONDVAR] = CondVar;
2919 }
2920
2924
2926 const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
2927 const Expr *getInc() const { return reinterpret_cast<Expr*>(SubExprs[INC]); }
2929
2932 void setInc(Expr *E) { SubExprs[INC] = reinterpret_cast<Stmt*>(E); }
2934
2941
2944
2946 return T->getStmtClass() == ForStmtClass;
2947 }
2948
2949
2951 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2952 }
2953
2957};
2958
2959
2963
2964public:
2966 : Stmt(GotoStmtClass), Label(label), LabelLoc(LL) {
2968 }
2969
2970
2972
2975
2980
2983
2985 return T->getStmtClass() == GotoStmtClass;
2986 }
2987
2988
2992
2996};
2997
2998
3001 Stmt *Target;
3002
3003public:
3005 : Stmt(IndirectGotoStmtClass), StarLoc(starLoc) {
3008 }
3009
3010
3013
3018
3021 return reinterpret_cast<const Expr *>(Target);
3022 }
3024
3025
3026
3031
3034
3036 return T->getStmtClass() == IndirectGotoStmtClass;
3037 }
3038
3039
3041
3045};
3046
3047
3049
3050
3051
3052
3053
3054
3055
3056
3057 LabelDecl *TargetLabel = nullptr;
3059
3060protected:
3066
3069
3071
3072public:
3075
3080
3082
3085
3089
3090
3091
3093
3094
3098
3102
3105 return Class == ContinueStmtClass || Class == BreakStmtClass;
3106 }
3107};
3108
3109
3111public:
3115
3116
3119
3121 return T->getStmtClass() == ContinueStmtClass;
3122 }
3123};
3124
3125
3127public:
3131
3132
3135
3137 return T->getStmtClass() == BreakStmtClass;
3138 }
3139};
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149class ReturnStmt final
3150 : public Stmt,
3151 private llvm::TrailingObjects<ReturnStmt, const VarDecl *> {
3152 friend TrailingObjects;
3153
3154
3155 Stmt *RetExpr;
3156
3157
3158
3159
3160
3161 bool hasNRVOCandidate() const { return ReturnStmtBits.HasNRVOCandidate; }
3162
3163
3165
3166
3167 explicit ReturnStmt(EmptyShell Empty, bool HasNRVOCandidate);
3168
3169public:
3170
3172 const VarDecl *NRVOCandidate);
3173
3174
3175
3177
3181
3182
3183
3184
3185
3186
3188 return hasNRVOCandidate() ? *getTrailingObjects() : nullptr;
3189 }
3190
3191
3192
3193
3195 assert(hasNRVOCandidate() &&
3196 "This return statement has no storage for an NRVO candidate!");
3197 *getTrailingObjects() = Var;
3198 }
3199
3202
3205 return RetExpr ? RetExpr->getEndLoc() : getReturnLoc();
3206 }
3207
3209 return T->getStmtClass() == ReturnStmtClass;
3210 }
3211
3212
3214 if (RetExpr)
3215 return child_range(&RetExpr, &RetExpr + 1);
3217 }
3218
3224};
3225
3226
3227class DeferStmt : public Stmt {
3229
3230
3232
3235
3236public:
3239 Stmt *Body);
3240
3245
3249 assert(S && "defer body must not be null");
3250 Body = S;
3251 }
3252
3255
3257
3261
3265};
3266
3267
3269protected:
3271
3273
3274
3275
3277
3278
3279
3281
3285
3287
3289 unsigned numoutputs, unsigned numinputs, unsigned numclobbers)
3293
3294public:
3295
3297
3300
3303
3306
3309
3310
3311
3312
3314
3315
3316
3318
3319
3320
3321
3323
3324
3325
3326
3330
3332
3333
3334
3336
3337
3338
3340
3341
3342
3344
3346
3347
3348
3350 std::string getClobber(unsigned i) const;
3351
3353 return T->getStmtClass() == GCCAsmStmtClass ||
3354 T->getStmtClass() == MSAsmStmtClass;
3355 }
3356
3357
3358
3363
3367
3371
3373
3377
3381
3385
3386
3387
3392
3394 return &Exprs[0];
3395 }
3396
3400
3404
3406 return &Exprs[0];
3407 }
3408
3412
3416
3420
3424};
3425
3426
3429
3431 Expr *AsmStr;
3432
3433
3434 Expr **Constraints = nullptr;
3435 Expr **Clobbers = nullptr;
3437 unsigned NumLabels = 0;
3438
3439public:
3441 bool isvolatile, unsigned numoutputs, unsigned numinputs,
3443 Expr *asmstr, unsigned numclobbers, Expr **clobbers,
3445
3446
3448
3451
3452
3453
3457
3459
3460
3461
3462
3464 public:
3469
3470 private:
3471 Kind MyKind;
3472 std::string Str;
3473 unsigned OperandNo;
3474
3475
3477
3478 public:
3482 : MyKind(Operand), Str(S), OperandNo(OpNo),
3484
3487
3488 const std::string &getString() const { return Str; }
3489
3492 return OperandNo;
3493 }
3494
3496 assert(isOperand() && "Range is currently used only for Operands.");
3497 return Range;
3498 }
3499
3500
3501
3503 };
3504
3505
3506
3507
3508
3509
3511 const ASTContext &C, unsigned &DiagOffs) const;
3512
3513
3515
3516
3517
3519
3522 return II->getName();
3523
3524 return {};
3525 }
3526
3528
3530 return Constraints[i];
3531 }
3533
3535
3539
3540
3541
3545
3548 return II->getName();
3549
3550 return {};
3551 }
3552
3554
3561
3564
3568
3570
3571
3572
3574 return NumLabels > 0;
3575 }
3576
3578 return NumLabels;
3579 }
3580
3584
3591
3595
3599
3603
3607
3611
3615
3616private:
3617 void setOutputsAndInputsAndClobbers(const ASTContext &C,
3621 unsigned NumLabels, Expr **Clobbers,
3623
3624public:
3625
3626
3627
3628
3629
3631
3632 std::string getClobber(unsigned i) const;
3633
3636
3639
3641 return T->getStmtClass() == GCCAsmStmtClass;
3642 }
3643};
3644
3645
3648
3650 StringRef AsmStr;
3651
3652 unsigned NumAsmToks = 0;
3653
3654 Token *AsmToks = nullptr;
3655 StringRef *Constraints = nullptr;
3656 StringRef *Clobbers = nullptr;
3657
3658public:
3660 SourceLocation lbraceloc, bool issimple, bool isvolatile,
3661 ArrayRef asmtoks, unsigned numoutputs, unsigned numinputs,
3665
3666
3668
3673
3674 bool hasBraces() const { return LBraceLoc.isValid(); }
3675
3678
3679
3681
3682
3684
3685
3686
3689 return Constraints[i];
3690 }
3691
3693
3697
3698
3699
3704
3707
3711
3712
3713
3717
3719
3723
3725
3726private:
3730
3731public:
3733
3735 return T->getStmtClass() == MSAsmStmtClass;
3736 }
3737
3741
3745};
3746
3747class SEHExceptStmt : public Stmt {
3750
3752 Stmt *Children[2];
3753
3754 enum { FILTER_EXPR, BLOCK };
3755
3757 explicit SEHExceptStmt(EmptyShell E) : Stmt(SEHExceptStmtClass, E) {}
3758
3759public:
3761 SourceLocation ExceptLoc,
3762 Expr *FilterExpr,
3763 Stmt *Block);
3764
3766
3769
3771 return reinterpret_cast<Expr*>(Children[FILTER_EXPR]);
3772 }
3773
3777
3781
3785
3787 return T->getStmtClass() == SEHExceptStmtClass;
3788 }
3789};
3790
3791class SEHFinallyStmt : public Stmt {
3794
3796 Stmt *Block;
3797
3799 explicit SEHFinallyStmt(EmptyShell E) : Stmt(SEHFinallyStmtClass, E) {}
3800
3801public:
3805
3807
3810
3812
3816
3820
3822 return T->getStmtClass() == SEHFinallyStmtClass;
3823 }
3824};
3825
3826class SEHTryStmt : public Stmt {
3829
3830 bool IsCXXTry;
3832 Stmt *Children[2];
3833
3834 enum { TRY = 0, HANDLER = 1 };
3835
3836 SEHTryStmt(bool isCXXTry,
3838 Stmt *TryBlock,
3839 Stmt *Handler);
3840
3841 explicit SEHTryStmt(EmptyShell E) : Stmt(SEHTryStmtClass, E) {}
3842
3843public:
3845 SourceLocation TryLoc, Stmt *TryBlock,
3846 Stmt *Handler);
3847
3849
3852
3854
3858
3860
3861
3864
3868
3872
3874 return T->getStmtClass() == SEHTryStmtClass;
3875 }
3876};
3877
3878
3881
3882public:
3884 : Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}
3885
3886
3888
3891
3894
3896 return T->getStmtClass() == SEHLeaveStmtClass;
3897 }
3898
3899
3903
3907};
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918class CapturedStmt : public Stmt {
3919public:
3920
3921
3928
3929
3930
3931 class Capture {
3932 llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
3934
3936
3937 public:
3940
3941
3942
3943
3944
3945
3946
3947
3949 VarDecl *Var = nullptr);
3950
3951
3953
3954
3955
3957
3958
3960
3961
3963
3964
3968
3969
3970
3974
3975
3976
3977
3979 };
3980
3981private:
3982
3983 unsigned NumCaptures;
3984
3985
3986
3987 llvm::PointerIntPair<CapturedDecl *, 2, CapturedRegionKind> CapDeclAndKind;
3988
3989
3990 RecordDecl *TheRecordDecl = nullptr;
3991
3992
3995
3996
3998
3999 Stmt **getStoredStmts() { return reinterpret_cast<Stmt **>(this + 1); }
4000
4001 Stmt *const *getStoredStmts() const {
4002 return reinterpret_cast<Stmt *const *>(this + 1);
4003 }
4004
4005 Capture *getStoredCaptures() const;
4006
4007 void setCapturedStmt(Stmt *S) { getStoredStmts()[NumCaptures] = S; }
4008
4009public:
4011
4017
4019 unsigned NumCaptures);
4020
4021
4024
4025
4028
4029
4031
4032
4034
4035
4037
4038
4040
4041
4043 assert(D && "null RecordDecl");
4044 TheRecordDecl = D;
4045 }
4046
4047
4049
4050
4055
4062
4063
4066
4067
4068
4070 return getStoredCaptures() + NumCaptures;
4071 }
4072
4073
4075
4076
4079
4080
4081
4084 llvm::iterator_range<const_capture_init_iterator>;
4085
4089
4093
4094
4096 return reinterpret_cast<Expr **>(getStoredStmts());
4097 }
4098
4100 return reinterpret_cast<Expr *const *>(getStoredStmts());
4101 }
4102
4103
4104
4108
4112
4116
4120
4124
4126 return T->getStmtClass() == CapturedStmtClass;
4127 }
4128
4130
4132};
4133
4134}
4135
4136#endif
static StringRef bytes(const std::vector< T, Allocator > &v)
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Defines enumerations for expression traits intrinsics.
SmallVector< AnnotatedLine *, 1 > Children
If this token starts a block, this contains all the unwrapped lines in it.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
Defines the clang::LangOptions interface.
Defines an enumeration for C++ overloaded operators.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
static std::pair< Stmt::Likelihood, const Attr * > getLikelihood(ArrayRef< const Attr * > Attrs)
#define NumStmtBits
Definition Stmt.h:113
Defines enumerations for the type traits support.
__device__ __2f16 float __ockl_bool s
__SIZE_TYPE__ size_t
The unsigned integer type of the result of the sizeof operator.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
AddrLabelExpr - The GNU address of label extension, representing &&label.
Stmt ** Exprs
Definition Stmt.h:3286
void setSimple(bool V)
Definition Stmt.h:3302
outputs_iterator begin_outputs()
Definition Stmt.h:3393
void setAsmLoc(SourceLocation L)
Definition Stmt.h:3299
const_outputs_iterator end_outputs() const
Definition Stmt.h:3409
std::string getInputConstraint(unsigned i) const
getInputConstraint - Return the specified input constraint.
SourceLocation AsmLoc
Definition Stmt.h:3272
bool isVolatile() const
Definition Stmt.h:3304
outputs_iterator end_outputs()
Definition Stmt.h:3397
const_inputs_iterator begin_inputs() const
Definition Stmt.h:3374
unsigned getNumPlusOperands() const
getNumPlusOperands - Return the number of output operands that have a "+" constraint.
std::string getOutputConstraint(unsigned i) const
getOutputConstraint - Return the constraint string for the specified output operand.
AsmStmt(StmtClass SC, SourceLocation asmloc, bool issimple, bool isvolatile, unsigned numoutputs, unsigned numinputs, unsigned numclobbers)
Definition Stmt.h:3288
void setVolatile(bool V)
Definition Stmt.h:3305
static bool classof(const Stmt *T)
Definition Stmt.h:3352
outputs_range outputs()
Definition Stmt.h:3401
inputs_const_range inputs() const
Definition Stmt.h:3382
SourceLocation getAsmLoc() const
Definition Stmt.h:3298
const Expr * getInputExpr(unsigned i) const
unsigned NumInputs
Definition Stmt.h:3283
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:3308
inputs_range inputs()
Definition Stmt.h:3372
llvm::iterator_range< inputs_iterator > inputs_range
Definition Stmt.h:3361
bool isOutputPlusConstraint(unsigned i) const
isOutputPlusConstraint - Return true if the specified output constraint is a "+" constraint (which is...
Definition Stmt.h:3327
unsigned getNumClobbers() const
Definition Stmt.h:3349
ExprIterator outputs_iterator
Definition Stmt.h:3388
const_inputs_iterator end_inputs() const
Definition Stmt.h:3378
llvm::iterator_range< const_inputs_iterator > inputs_const_range
Definition Stmt.h:3362
const_child_range children() const
Definition Stmt.h:3421
ExprIterator inputs_iterator
Definition Stmt.h:3359
bool IsSimple
True if the assembly statement does not have any input or output operands.
Definition Stmt.h:3276
const Expr * getOutputExpr(unsigned i) const
outputs_const_range outputs() const
Definition Stmt.h:3413
inputs_iterator end_inputs()
Definition Stmt.h:3368
unsigned getNumOutputs() const
Definition Stmt.h:3317
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:3307
inputs_iterator begin_inputs()
Definition Stmt.h:3364
AsmStmt(StmtClass SC, EmptyShell Empty)
Build an empty inline-assembly statement.
Definition Stmt.h:3296
unsigned NumOutputs
Definition Stmt.h:3282
child_range children()
Definition Stmt.h:3417
ConstExprIterator const_outputs_iterator
Definition Stmt.h:3389
ConstExprIterator const_inputs_iterator
Definition Stmt.h:3360
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
unsigned NumClobbers
Definition Stmt.h:3284
bool IsVolatile
If true, treat this inline assembly as having side effects.
Definition Stmt.h:3280
friend class ASTStmtReader
Definition Stmt.h:3270
unsigned getNumInputs() const
Definition Stmt.h:3339
bool isSimple() const
Definition Stmt.h:3301
llvm::iterator_range< outputs_iterator > outputs_range
Definition Stmt.h:3390
const_outputs_iterator begin_outputs() const
Definition Stmt.h:3405
std::string getClobber(unsigned i) const
llvm::iterator_range< const_outputs_iterator > outputs_const_range
Definition Stmt.h:3391
Attr - This represents one attribute.
Represents an attribute applied to a statement.
Definition Stmt.h:2194
static AttributedStmt * CreateEmpty(const ASTContext &C, unsigned NumAttrs)
Stmt * getSubStmt()
Definition Stmt.h:2230
const Stmt * getSubStmt() const
Definition Stmt.h:2231
SourceLocation getAttrLoc() const
Definition Stmt.h:2225
ArrayRef< const Attr * > getAttrs() const
Definition Stmt.h:2226
child_range children()
Definition Stmt.h:2236
const_child_range children() const
Definition Stmt.h:2238
friend class ASTStmtReader
Definition Stmt.h:2195
static bool classof(const Stmt *T)
Definition Stmt.h:2242
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2234
SourceLocation getBeginLoc() const
Definition Stmt.h:2233
BreakStmt(SourceLocation BL)
Definition Stmt.h:3128
static bool classof(const Stmt *T)
Definition Stmt.h:3136
BreakStmt(EmptyShell Empty)
Build an empty break statement.
Definition Stmt.h:3133
BreakStmt(SourceLocation CL, SourceLocation LabelLoc, LabelDecl *Target)
Definition Stmt.h:3129
Represents the body of a CapturedStmt, and serves as its DeclContext.
Describes the capture of either a variable, or 'this', or variable-length array type.
Definition Stmt.h:3931
bool capturesVariableByCopy() const
Determine whether this capture handles a variable by copy.
Definition Stmt.h:3965
VariableCaptureKind getCaptureKind() const
Determine the kind of capture.
VarDecl * getCapturedVar() const
Retrieve the declaration of the variable being captured.
bool capturesVariableArrayType() const
Determine whether this capture handles a variable-length array type.
Definition Stmt.h:3971
friend class CapturedStmt
Definition Stmt.h:3939
bool capturesThis() const
Determine whether this capture handles the C++ 'this' pointer.
Definition Stmt.h:3959
bool capturesVariable() const
Determine whether this capture handles a variable (by reference).
Definition Stmt.h:3962
SourceLocation getLocation() const
Retrieve the source location at which the variable or 'this' was first used.
Definition Stmt.h:3956
friend class ASTStmtReader
Definition Stmt.h:3938
This captures a statement into a function.
Definition Stmt.h:3918
unsigned capture_size() const
Retrieve the number of captures, including 'this'.
Definition Stmt.h:4074
const_capture_iterator capture_begin() const
Definition Stmt.h:4065
static CapturedStmt * CreateDeserialized(const ASTContext &Context, unsigned NumCaptures)
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:4117
capture_init_range capture_inits()
Definition Stmt.h:4086
Expr ** capture_init_iterator
Iterator that walks over the capture initialization arguments.
Definition Stmt.h:4077
void setCapturedRegionKind(CapturedRegionKind Kind)
Set the captured region kind.
const_capture_init_iterator capture_init_begin() const
Definition Stmt.h:4099
const Capture * const_capture_iterator
Definition Stmt.h:4052
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
SourceRange getSourceRange() const LLVM_READONLY
Definition Stmt.h:4121
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of captures.
Definition Stmt.h:4069
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
Definition Stmt.h:4039
llvm::iterator_range< const_capture_init_iterator > const_capture_init_range
Definition Stmt.h:4083
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition Stmt.h:4022
llvm::iterator_range< capture_init_iterator > capture_init_range
Definition Stmt.h:4078
Capture * capture_iterator
An iterator that walks over the captures.
Definition Stmt.h:4051
llvm::iterator_range< capture_iterator > capture_range
Definition Stmt.h:4053
bool capturesVariable(const VarDecl *Var) const
True if this variable has been captured.
static bool classof(const Stmt *T)
Definition Stmt.h:4125
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument.
Definition Stmt.h:4095
void setCapturedDecl(CapturedDecl *D)
Set the outlined function declaration.
capture_iterator capture_begin()
Retrieve an iterator pointing to the first capture.
Definition Stmt.h:4064
const_capture_init_iterator capture_init_end() const
Definition Stmt.h:4109
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:4113
void setCapturedRecordDecl(RecordDecl *D)
Set the record declaration for captured variables.
Definition Stmt.h:4042
friend class ASTStmtReader
Definition Stmt.h:4010
llvm::iterator_range< const_capture_iterator > capture_const_range
Definition Stmt.h:4054
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument.
Definition Stmt.h:4105
capture_range captures()
Definition Stmt.h:4056
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
Definition Stmt.h:4082
const Stmt * getCapturedStmt() const
Definition Stmt.h:4023
capture_const_range captures() const
Definition Stmt.h:4059
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
VariableCaptureKind
The different capture forms: by 'this', by reference, capture for variable-length array type etc.
Definition Stmt.h:3922
@ VCK_ByCopy
Definition Stmt.h:3925
@ VCK_ByRef
Definition Stmt.h:3924
@ VCK_This
Definition Stmt.h:3923
@ VCK_VLAType
Definition Stmt.h:3926
const_capture_init_range capture_inits() const
Definition Stmt.h:4090
Stmt * getSubStmt()
Definition Stmt.h:2024
const Expr * getRHS() const
Definition Stmt.h:2012
Expr * getLHS()
Definition Stmt.h:1994
const_child_range children() const
Definition Stmt.h:2054
SourceLocation getBeginLoc() const
Definition Stmt.h:2033
void setEllipsisLoc(SourceLocation L)
Set the location of the ... in a case statement of the form LHS ... RHS.
Definition Stmt.h:1987
static bool classof(const Stmt *T)
Definition Stmt.h:2043
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ... RHS, which is a GNU extension.
Definition Stmt.h:1974
const Expr * getLHS() const
Definition Stmt.h:1998
SourceLocation getEllipsisLoc() const
Get the location of the ... in a case statement of the form LHS ... RHS.
Definition Stmt.h:1980
void setCaseLoc(SourceLocation L)
Definition Stmt.h:1977
child_range children()
Definition Stmt.h:2048
SourceLocation getCaseLoc() const
Definition Stmt.h:1976
static CaseStmt * CreateEmpty(const ASTContext &Ctx, bool CaseStmtIsGNURange)
Build an empty case statement.
void setLHS(Expr *Val)
Definition Stmt.h:2002
void setSubStmt(Stmt *S)
Definition Stmt.h:2029
const Stmt * getSubStmt() const
Definition Stmt.h:2025
Expr * getRHS()
Definition Stmt.h:2006
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2034
void setRHS(Expr *Val)
Definition Stmt.h:2018
Represents a character-granular source range.
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition Stmt.h:1731
Stmt * body_front()
Definition Stmt.h:1797
static bool classof(const Stmt *T)
Definition Stmt.h:1851
bool body_empty() const
Definition Stmt.h:1775
unsigned size() const
Definition Stmt.h:1776
body_const_range body() const
Definition Stmt.h:1806
Stmt *const * const_body_iterator
Definition Stmt.h:1803
const_reverse_body_iterator body_rend() const
Definition Stmt.h:1841
llvm::iterator_range< const_body_iterator > body_const_range
Definition Stmt.h:1804
std::reverse_iterator< body_iterator > reverse_body_iterator
Definition Stmt.h:1824
reverse_body_iterator body_rbegin()
Definition Stmt.h:1826
llvm::iterator_range< body_iterator > body_range
Definition Stmt.h:1792
std::reverse_iterator< const_body_iterator > const_reverse_body_iterator
Definition Stmt.h:1834
body_iterator body_end()
Definition Stmt.h:1796
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
Definition Stmt.h:1781
const Stmt * body_front() const
Definition Stmt.h:1816
body_range body()
Definition Stmt.h:1794
SourceLocation getBeginLoc() const
Definition Stmt.h:1845
static CompoundStmt * CreateEmpty(const ASTContext &C, unsigned NumStmts, bool HasFPFeatures)
SourceLocation getLBracLoc() const
Definition Stmt.h:1848
body_iterator body_begin()
Definition Stmt.h:1795
SourceLocation getEndLoc() const
Definition Stmt.h:1846
bool hasStoredFPFeatures() const
Definition Stmt.h:1778
const_child_range children() const
Definition Stmt.h:1858
CompoundStmt(SourceLocation Loc, SourceLocation EndLoc)
Definition Stmt.h:1765
reverse_body_iterator body_rend()
Definition Stmt.h:1830
CompoundStmt(SourceLocation Loc)
Definition Stmt.h:1763
const_body_iterator body_begin() const
Definition Stmt.h:1810
Stmt ** body_iterator
Definition Stmt.h:1791
const Stmt * body_back() const
Definition Stmt.h:1820
friend class ASTStmtReader
Definition Stmt.h:1732
const_reverse_body_iterator body_rbegin() const
Definition Stmt.h:1837
child_range children()
Definition Stmt.h:1856
Stmt * body_back()
Definition Stmt.h:1799
FPOptionsOverride getStoredFPFeaturesOrDefault() const
Get the store FPOptionsOverride or default if not stored.
Definition Stmt.h:1787
SourceLocation getRBracLoc() const
Definition Stmt.h:1849
const_body_iterator body_end() const
Definition Stmt.h:1814
ContinueStmt(EmptyShell Empty)
Build an empty continue statement.
Definition Stmt.h:3117
ContinueStmt(SourceLocation CL)
Definition Stmt.h:3112
static bool classof(const Stmt *T)
Definition Stmt.h:3120
ContinueStmt(SourceLocation CL, SourceLocation LabelLoc, LabelDecl *Target)
Definition Stmt.h:3113
Decl *const * const_iterator
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition Stmt.h:1622
std::reverse_iterator< decl_iterator > reverse_decl_iterator
Definition Stmt.h:1681
llvm::iterator_range< decl_iterator > decl_range
Definition Stmt.h:1667
child_range children()
Definition Stmt.h:1655
const_child_range children() const
Definition Stmt.h:1660
Decl * getSingleDecl()
Definition Stmt.h:1638
SourceLocation getEndLoc() const
Definition Stmt.h:1645
const DeclGroupRef getDeclGroup() const
Definition Stmt.h:1640
DeclStmt(EmptyShell Empty)
Build an empty declaration statement.
Definition Stmt.h:1631
bool isSingleDecl() const
isSingleDecl - This method returns true if this DeclStmt refers to a single Decl.
Definition Stmt.h:1635
decl_iterator decl_end()
Definition Stmt.h:1677
const_decl_iterator decl_begin() const
Definition Stmt.h:1678
void setStartLoc(SourceLocation L)
Definition Stmt.h:1644
DeclGroupRef::const_iterator const_decl_iterator
Definition Stmt.h:1666
static bool classof(const Stmt *T)
Definition Stmt.h:1650
void setEndLoc(SourceLocation L)
Definition Stmt.h:1646
decl_iterator decl_begin()
Definition Stmt.h:1676
decl_range decls()
Definition Stmt.h:1670
void setDeclGroup(DeclGroupRef DGR)
Definition Stmt.h:1642
const Decl * getSingleDecl() const
Definition Stmt.h:1637
decl_const_range decls() const
Definition Stmt.h:1672
const_decl_iterator decl_end() const
Definition Stmt.h:1679
DeclGroupRef::iterator decl_iterator
Definition Stmt.h:1665
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:1648
DeclGroupRef getDeclGroup()
Definition Stmt.h:1641
reverse_decl_iterator decl_rend()
Definition Stmt.h:1687
llvm::iterator_range< const_decl_iterator > decl_const_range
Definition Stmt.h:1668
reverse_decl_iterator decl_rbegin()
Definition Stmt.h:1683
DeclStmt(DeclGroupRef dg, SourceLocation startLoc, SourceLocation endLoc)
Definition Stmt.h:1627
Decl - This represents one declaration (or definition), e.g.
void setSubStmt(Stmt *S)
Definition Stmt.h:2074
const Stmt * getSubStmt() const
Definition Stmt.h:2073
child_range children()
Definition Stmt.h:2089
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2080
void setDefaultLoc(SourceLocation L)
Definition Stmt.h:2077
SourceLocation getDefaultLoc() const
Definition Stmt.h:2076
DefaultStmt(EmptyShell Empty)
Build an empty default statement.
Definition Stmt.h:2069
static bool classof(const Stmt *T)
Definition Stmt.h:2084
DefaultStmt(SourceLocation DL, SourceLocation CL, Stmt *substmt)
Definition Stmt.h:2065
const_child_range children() const
Definition Stmt.h:2091
SourceLocation getBeginLoc() const
Definition Stmt.h:2079
Stmt * getSubStmt()
Definition Stmt.h:2072
const Stmt * getBody() const
Definition Stmt.h:3247
SourceLocation getEndLoc() const
Definition Stmt.h:3254
void setBody(Stmt *S)
Definition Stmt.h:3248
SourceLocation getBeginLoc() const
Definition Stmt.h:3253
void setDeferLoc(SourceLocation DeferLoc)
Definition Stmt.h:3242
Stmt * getBody()
Definition Stmt.h:3246
const_child_range children() const
Definition Stmt.h:3258
SourceLocation getDeferLoc() const
Definition Stmt.h:3241
static bool classof(const Stmt *S)
Definition Stmt.h:3262
static DeferStmt * CreateEmpty(ASTContext &Context, EmptyShell Empty)
friend class ASTStmtReader
Definition Stmt.h:3228
child_range children()
Definition Stmt.h:3256
void setWhileLoc(SourceLocation L)
Definition Stmt.h:2855
SourceLocation getBeginLoc() const
Definition Stmt.h:2859
Stmt * getBody()
Definition Stmt.h:2848
Expr * getCond()
Definition Stmt.h:2841
void setDoLoc(SourceLocation L)
Definition Stmt.h:2853
SourceLocation getEndLoc() const
Definition Stmt.h:2860
SourceLocation getWhileLoc() const
Definition Stmt.h:2854
static bool classof(const Stmt *T)
Definition Stmt.h:2862
const_child_range children() const
Definition Stmt.h:2871
DoStmt(EmptyShell Empty)
Build an empty do-while statement.
Definition Stmt.h:2839
SourceLocation getDoLoc() const
Definition Stmt.h:2852
void setRParenLoc(SourceLocation L)
Definition Stmt.h:2857
SourceLocation getRParenLoc() const
Definition Stmt.h:2856
const Stmt * getBody() const
Definition Stmt.h:2849
child_range children()
Definition Stmt.h:2867
void setBody(Stmt *Body)
Definition Stmt.h:2850
DoStmt(Stmt *Body, Expr *Cond, SourceLocation DL, SourceLocation WL, SourceLocation RP)
Definition Stmt.h:2830
const Expr * getCond() const
Definition Stmt.h:2842
void setCond(Expr *Cond)
Definition Stmt.h:2846
This represents one expression.
Represents difference between two FPOptions values.
Stmt * getInit()
Definition Stmt.h:2894
ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP, SourceLocation RP)
child_range children()
Definition Stmt.h:2950
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "for" statement, if any.
SourceLocation getEndLoc() const
Definition Stmt.h:2943
void setBody(Stmt *S)
Definition Stmt.h:2933
SourceLocation getRParenLoc() const
Definition Stmt.h:2939
const_child_range children() const
Definition Stmt.h:2954
void setCond(Expr *E)
Definition Stmt.h:2931
const DeclStmt * getConditionVariableDeclStmt() const
Definition Stmt.h:2913
void setForLoc(SourceLocation L)
Definition Stmt.h:2936
Stmt * getBody()
Definition Stmt.h:2923
const Expr * getInc() const
Definition Stmt.h:2927
ForStmt(EmptyShell Empty)
Build an empty for statement.
Definition Stmt.h:2892
void setInc(Expr *E)
Definition Stmt.h:2932
void setLParenLoc(SourceLocation L)
Definition Stmt.h:2938
Expr * getInc()
Definition Stmt.h:2922
const Expr * getCond() const
Definition Stmt.h:2926
void setInit(Stmt *S)
Definition Stmt.h:2930
void setConditionVariableDeclStmt(DeclStmt *CondVar)
Definition Stmt.h:2917
SourceLocation getBeginLoc() const
Definition Stmt.h:2942
static bool classof(const Stmt *T)
Definition Stmt.h:2945
const Stmt * getInit() const
Definition Stmt.h:2925
void setConditionVariable(const ASTContext &C, VarDecl *V)
SourceLocation getForLoc() const
Definition Stmt.h:2935
friend class ASTStmtReader
Definition Stmt.h:2880
const Stmt * getBody() const
Definition Stmt.h:2928
Expr * getCond()
Definition Stmt.h:2921
SourceLocation getLParenLoc() const
Definition Stmt.h:2937
DeclStmt * getConditionVariableDeclStmt()
If this ForStmt has a condition variable, return the faux DeclStmt associated with the creation of th...
Definition Stmt.h:2909
void setRParenLoc(SourceLocation L)
Definition Stmt.h:2940
bool isString() const
Definition Stmt.h:3485
bool isOperand() const
Definition Stmt.h:3486
AsmStringPiece(const std::string &S)
Definition Stmt.h:3479
const std::string & getString() const
Definition Stmt.h:3488
unsigned getOperandNo() const
Definition Stmt.h:3490
Kind
Definition Stmt.h:3465
@ Operand
Definition Stmt.h:3467
@ String
Definition Stmt.h:3466
CharSourceRange getRange() const
Definition Stmt.h:3495
AsmStringPiece(unsigned OpNo, const std::string &S, SourceLocation Begin, SourceLocation End)
Definition Stmt.h:3480
char getModifier() const
getModifier - Get the modifier for this operand, if present.
const Expr * getInputExpr(unsigned i) const
Definition Stmt.h:3565
const_labels_iterator end_labels() const
Definition Stmt.h:3608
std::string getOutputConstraint(unsigned i) const
getOutputConstraint - Return the constraint string for the specified output operand.
unsigned getNumLabels() const
Definition Stmt.h:3577
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
labels_range labels()
Definition Stmt.h:3600
SourceLocation getRParenLoc() const
Definition Stmt.h:3449
std::string getAsmString() const
labels_const_range labels() const
Definition Stmt.h:3612
llvm::iterator_range< labels_iterator > labels_range
Definition Stmt.h:3589
Expr * getInputConstraintExpr(unsigned i)
Definition Stmt.h:3558
void setAsmStringExpr(Expr *E)
Definition Stmt.h:3456
labels_iterator begin_labels()
Definition Stmt.h:3592
IdentifierInfo * getInputIdentifier(unsigned i) const
Definition Stmt.h:3542
bool isAsmGoto() const
Definition Stmt.h:3573
ConstCastIterator< AddrLabelExpr > const_labels_iterator
Definition Stmt.h:3588
CastIterator< AddrLabelExpr > labels_iterator
Definition Stmt.h:3587
const Expr * getClobberExpr(unsigned i) const
Definition Stmt.h:3635
std::string getInputConstraint(unsigned i) const
getInputConstraint - Return the specified input constraint.
labels_iterator end_labels()
Definition Stmt.h:3596
const Expr * getOutputConstraintExpr(unsigned i) const
Definition Stmt.h:3529
StringRef getLabelName(unsigned i) const
unsigned AnalyzeAsmString(SmallVectorImpl< AsmStringPiece > &Pieces, const ASTContext &C, unsigned &DiagOffs) const
AnalyzeAsmString - Analyze the asm string of the current asm, decomposing it into pieces.
void setRParenLoc(SourceLocation L)
Definition Stmt.h:3450
void setInputExpr(unsigned i, Expr *E)
Expr * getAsmStringExpr()
Definition Stmt.h:3455
std::string getClobber(unsigned i) const
static bool classof(const Stmt *T)
Definition Stmt.h:3640
StringRef getInputName(unsigned i) const
Definition Stmt.h:3546
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:3638
StringRef getOutputName(unsigned i) const
Definition Stmt.h:3520
const_labels_iterator begin_labels() const
Definition Stmt.h:3604
GCCAsmStmt(EmptyShell Empty)
Build an empty inline-assembly statement.
Definition Stmt.h:3447
IdentifierInfo * getLabelIdentifier(unsigned i) const
Definition Stmt.h:3581
const Expr * getInputConstraintExpr(unsigned i) const
Definition Stmt.h:3555
IdentifierInfo * getOutputIdentifier(unsigned i) const
Definition Stmt.h:3518
const Expr * getAsmStringExpr() const
Definition Stmt.h:3454
Expr * getOutputExpr(unsigned i)
llvm::iterator_range< const_labels_iterator > labels_const_range
Definition Stmt.h:3590
GCCAsmStmt(const ASTContext &C, SourceLocation asmloc, bool issimple, bool isvolatile, unsigned numoutputs, unsigned numinputs, IdentifierInfo **names, Expr **constraints, Expr **exprs, Expr *asmstr, unsigned numclobbers, Expr **clobbers, unsigned numlabels, SourceLocation rparenloc)
Expr * getOutputConstraintExpr(unsigned i)
Definition Stmt.h:3532
Expr * getClobberExpr(unsigned i)
Definition Stmt.h:3634
int getNamedOperand(StringRef SymbolicName) const
getNamedOperand - Given a symbolic operand reference like %[foo], translate this into a numeric value...
friend class ASTStmtReader
Definition Stmt.h:3428
const Expr * getOutputExpr(unsigned i) const
Definition Stmt.h:3536
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:3637
Expr * getInputExpr(unsigned i)
AddrLabelExpr * getLabelExpr(unsigned i) const
static std::string ExtractStringFromGCCAsmStmtComponent(const Expr *E)
GotoStmt(LabelDecl *label, SourceLocation GL, SourceLocation LL)
Definition Stmt.h:2965
SourceLocation getLabelLoc() const
Definition Stmt.h:2978
SourceLocation getGotoLoc() const
Definition Stmt.h:2976
child_range children()
Definition Stmt.h:2989
void setLabel(LabelDecl *D)
Definition Stmt.h:2974
GotoStmt(EmptyShell Empty)
Build an empty goto statement.
Definition Stmt.h:2971
void setLabelLoc(SourceLocation L)
Definition Stmt.h:2979
LabelDecl * getLabel() const
Definition Stmt.h:2973
SourceLocation getEndLoc() const
Definition Stmt.h:2982
const_child_range children() const
Definition Stmt.h:2993
static bool classof(const Stmt *T)
Definition Stmt.h:2984
void setGotoLoc(SourceLocation L)
Definition Stmt.h:2977
SourceLocation getBeginLoc() const
Definition Stmt.h:2981
One of these records is kept for each identifier that is lexed.
Stmt * getThen()
Definition Stmt.h:2339
bool hasElseStorage() const
True if this IfStmt has storage for an else statement.
Definition Stmt.h:2325
const Stmt * getElse() const
Definition Stmt.h:2353
void setThen(Stmt *Then)
Definition Stmt.h:2344
void setConditionVariableDeclStmt(DeclStmt *CondVar)
Definition Stmt.h:2395
void setCond(Expr *Cond)
Definition Stmt.h:2335
void setLParenLoc(SourceLocation Loc)
Definition Stmt.h:2469
SourceLocation getIfLoc() const
Definition Stmt.h:2416
void setConditionVariable(const ASTContext &Ctx, VarDecl *V)
Set the condition variable for this if statement.
bool hasVarStorage() const
True if this IfStmt has storage for a variable declaration.
Definition Stmt.h:2322
const DeclStmt * getConditionVariableDeclStmt() const
Definition Stmt.h:2389
IfStatementKind getStatementKind() const
Definition Stmt.h:2451
SourceLocation getElseLoc() const
Definition Stmt.h:2419
Stmt * getInit()
Definition Stmt.h:2400
bool isNonNegatedConsteval() const
Definition Stmt.h:2435
SourceLocation getLParenLoc() const
Definition Stmt.h:2468
static bool classof(const Stmt *T)
Definition Stmt.h:2493
void setElse(Stmt *Else)
Definition Stmt.h:2358
Expr * getCond()
Definition Stmt.h:2327
const Stmt * getThen() const
Definition Stmt.h:2340
bool isConstexpr() const
Definition Stmt.h:2443
const Expr * getCond() const
Definition Stmt.h:2331
const VarDecl * getConditionVariable() const
Definition Stmt.h:2373
void setElseLoc(SourceLocation ElseLoc)
Definition Stmt.h:2424
const Stmt * getInit() const
Definition Stmt.h:2405
static IfStmt * CreateEmpty(const ASTContext &Ctx, bool HasElse, bool HasVar, bool HasInit)
Create an empty IfStmt optionally with storage for an else statement, condition variable and init exp...
bool hasInitStorage() const
True if this IfStmt has the storage for an init statement.
Definition Stmt.h:2319
void setStatementKind(IfStatementKind Kind)
Definition Stmt.h:2447
std::optional< const Stmt * > getNondiscardedCase(const ASTContext &Ctx) const
If this is an 'if constexpr', determine which substatement will be taken.
bool isObjCAvailabilityCheck() const
child_range children()
Definition Stmt.h:2475
bool isNegatedConsteval() const
Definition Stmt.h:2439
Stmt * getElse()
Definition Stmt.h:2348
DeclStmt * getConditionVariableDeclStmt()
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
Definition Stmt.h:2383
const_child_range children() const
Definition Stmt.h:2484
SourceLocation getRParenLoc() const
Definition Stmt.h:2470
void setRParenLoc(SourceLocation Loc)
Definition Stmt.h:2471
SourceLocation getBeginLoc() const
Definition Stmt.h:2462
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2463
bool isConsteval() const
Definition Stmt.h:2430
void setIfLoc(SourceLocation IfLoc)
Definition Stmt.h:2417
VarDecl * getConditionVariable()
Retrieve the variable declared in this "if" statement, if any.
void setInit(Stmt *Init)
Definition Stmt.h:2410
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:3033
static bool classof(const Stmt *T)
Definition Stmt.h:3035
LabelDecl * getConstantTarget()
getConstantTarget - Returns the fixed target of this indirect goto, if one exists.
IndirectGotoStmt(SourceLocation gotoLoc, SourceLocation starLoc, Expr *target)
Definition Stmt.h:3004
void setTarget(Expr *E)
Definition Stmt.h:3023
SourceLocation getGotoLoc() const
Definition Stmt.h:3015
SourceLocation getBeginLoc() const
Definition Stmt.h:3032
child_range children()
Definition Stmt.h:3040
void setGotoLoc(SourceLocation L)
Definition Stmt.h:3014
Expr * getTarget()
Definition Stmt.h:3019
const_child_range children() const
Definition Stmt.h:3042
const LabelDecl * getConstantTarget() const
Definition Stmt.h:3028
void setStarLoc(SourceLocation L)
Definition Stmt.h:3016
IndirectGotoStmt(EmptyShell Empty)
Build an empty indirect goto statement.
Definition Stmt.h:3011
const Expr * getTarget() const
Definition Stmt.h:3020
SourceLocation getStarLoc() const
Definition Stmt.h:3017
Represents the declaration of a label.
Stmt * getInnermostLabeledStmt()
Definition Stmt.h:2170
LabelStmt(SourceLocation IL, LabelDecl *D, Stmt *substmt)
Build a label statement.
Definition Stmt.h:2144
static bool classof(const Stmt *T)
Definition Stmt.h:2181
LabelDecl * getDecl() const
Definition Stmt.h:2155
LabelStmt(EmptyShell Empty)
Build an empty label statement.
Definition Stmt.h:2150
bool isSideEntry() const
Definition Stmt.h:2184
Stmt * getSubStmt()
Definition Stmt.h:2159
SourceLocation getIdentLoc() const
Definition Stmt.h:2152
void setSubStmt(Stmt *SS)
Definition Stmt.h:2162
void setDecl(LabelDecl *D)
Definition Stmt.h:2156
SourceLocation getBeginLoc() const
Definition Stmt.h:2164
void setIdentLoc(SourceLocation L)
Definition Stmt.h:2153
const_child_range children() const
Definition Stmt.h:2177
const Stmt * getInnermostLabeledStmt() const
Look through nested labels and return the first non-label statement; e.g.
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2165
child_range children()
Definition Stmt.h:2175
void setSideEntry(bool SE)
Definition Stmt.h:2185
const char * getName() const
const Stmt * getSubStmt() const
Definition Stmt.h:2161
SourceLocation getBeginLoc() const
Definition Stmt.h:3076
LoopControlStmt(StmtClass Class, SourceLocation Loc)
Definition Stmt.h:3067
LoopControlStmt(StmtClass Class, EmptyShell ES)
Definition Stmt.h:3070
void setLabelDecl(LabelDecl *S)
Definition Stmt.h:3088
LoopControlStmt(StmtClass Class, SourceLocation Loc, SourceLocation LabelLoc, LabelDecl *Target)
Definition Stmt.h:3061
static bool classof(const Stmt *T)
Definition Stmt.h:3103
SourceLocation getLabelLoc() const
Definition Stmt.h:3083
LabelDecl * getLabelDecl()
Definition Stmt.h:3086
const LabelDecl * getLabelDecl() const
Definition Stmt.h:3087
void setLabelLoc(SourceLocation L)
Definition Stmt.h:3084
const_child_range children() const
Definition Stmt.h:3099
SourceLocation getKwLoc() const
Definition Stmt.h:3073
child_range children()
Definition Stmt.h:3095
void setKwLoc(SourceLocation L)
Definition Stmt.h:3074
const Stmt * getNamedLoopOrSwitch() const
If this is a named break/continue, get the loop or switch statement that this targets.
bool hasLabelTarget() const
Definition Stmt.h:3081
SourceLocation getEndLoc() const
Definition Stmt.h:3077
Token * getAsmToks()
Definition Stmt.h:3677
const Expr * getOutputExpr(unsigned i) const
Definition Stmt.h:3694
Expr * getOutputExpr(unsigned i)
ArrayRef< StringRef > getClobbers() const
Definition Stmt.h:3718
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:3732
StringRef getAsmString() const
Definition Stmt.h:3680
child_range children()
Definition Stmt.h:3738
SourceLocation getLBraceLoc() const
Definition Stmt.h:3669
bool hasBraces() const
Definition Stmt.h:3674
SourceLocation getEndLoc() const
Definition Stmt.h:3671
StringRef getInputConstraint(unsigned i) const
Definition Stmt.h:3700
void setEndLoc(SourceLocation L)
Definition Stmt.h:3672
void setInputExpr(unsigned i, Expr *E)
StringRef getOutputConstraint(unsigned i) const
Definition Stmt.h:3687
ArrayRef< StringRef > getAllConstraints() const
Definition Stmt.h:3714
static bool classof(const Stmt *T)
Definition Stmt.h:3734
friend class ASTStmtReader
Definition Stmt.h:3647
StringRef getClobber(unsigned i) const
Definition Stmt.h:3724
const Expr * getInputExpr(unsigned i) const
Definition Stmt.h:3708
MSAsmStmt(const ASTContext &C, SourceLocation asmloc, SourceLocation lbraceloc, bool issimple, bool isvolatile, ArrayRef< Token > asmtoks, unsigned numoutputs, unsigned numinputs, ArrayRef< StringRef > constraints, ArrayRef< Expr * > exprs, StringRef asmstr, ArrayRef< StringRef > clobbers, SourceLocation endloc)
unsigned getNumAsmToks()
Definition Stmt.h:3676
void setLBraceLoc(SourceLocation L)
Definition Stmt.h:3670
MSAsmStmt(EmptyShell Empty)
Build an empty MS-style inline-assembly statement.
Definition Stmt.h:3667
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
const_child_range children() const
Definition Stmt.h:3742
ArrayRef< Expr * > getAllExprs() const
Definition Stmt.h:3720
Expr * getInputExpr(unsigned i)
void setSemiLoc(SourceLocation L)
Definition Stmt.h:1706
bool hasLeadingEmptyMacro() const
Definition Stmt.h:1708
SourceLocation getBeginLoc() const
Definition Stmt.h:1712
child_range children()
Definition Stmt.h:1719
SourceLocation getSemiLoc() const
Definition Stmt.h:1705
static bool classof(const Stmt *T)
Definition Stmt.h:1715
NullStmt(SourceLocation L, bool hasLeadingEmptyMacro=false)
Definition Stmt.h:1696
NullStmt(EmptyShell Empty)
Build an empty null statement.
Definition Stmt.h:1703
const_child_range children() const
Definition Stmt.h:1723
SourceLocation getEndLoc() const
Definition Stmt.h:1713
Represents a struct/union/class.
void setRetValue(Expr *E)
Definition Stmt.h:3180
void setReturnLoc(SourceLocation L)
Definition Stmt.h:3201
SourceLocation getReturnLoc() const
Definition Stmt.h:3200
static bool classof(const Stmt *T)
Definition Stmt.h:3208
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:3204
void setNRVOCandidate(const VarDecl *Var)
Set the variable that might be used for the named return value optimization.
Definition Stmt.h:3194
SourceLocation getBeginLoc() const
Definition Stmt.h:3203
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization.
Definition Stmt.h:3187
const_child_range children() const
Definition Stmt.h:3219
Expr * getRetValue()
Definition Stmt.h:3178
static ReturnStmt * CreateEmpty(const ASTContext &Ctx, bool HasNRVOCandidate)
Create an empty return statement, optionally with storage for an NRVO candidate.
child_range children()
Definition Stmt.h:3213
const Expr * getRetValue() const
Definition Stmt.h:3179
const_child_range children() const
Definition Stmt.h:3782
child_range children()
Definition Stmt.h:3778
CompoundStmt * getBlock() const
Definition Stmt.h:3774
friend class ASTReader
Definition Stmt.h:3748
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:3765
SourceLocation getExceptLoc() const
Definition Stmt.h:3767
friend class ASTStmtReader
Definition Stmt.h:3749
SourceLocation getEndLoc() const
Definition Stmt.h:3768
static bool classof(const Stmt *T)
Definition Stmt.h:3786
Expr * getFilterExpr() const
Definition Stmt.h:3770
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:3806
SourceLocation getEndLoc() const
Definition Stmt.h:3809
const_child_range children() const
Definition Stmt.h:3817
child_range children()
Definition Stmt.h:3813
friend class ASTReader
Definition Stmt.h:3792
SourceLocation getFinallyLoc() const
Definition Stmt.h:3808
static bool classof(const Stmt *T)
Definition Stmt.h:3821
friend class ASTStmtReader
Definition Stmt.h:3793
CompoundStmt * getBlock() const
Definition Stmt.h:3811
SourceLocation getLeaveLoc() const
Definition Stmt.h:3889
child_range children()
Definition Stmt.h:3900
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:3893
SEHLeaveStmt(EmptyShell Empty)
Build an empty __leave statement.
Definition Stmt.h:3887
SEHLeaveStmt(SourceLocation LL)
Definition Stmt.h:3883
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:3892
static bool classof(const Stmt *T)
Definition Stmt.h:3895
void setLeaveLoc(SourceLocation L)
Definition Stmt.h:3890
const_child_range children() const
Definition Stmt.h:3904
child_range children()
Definition Stmt.h:3865
const_child_range children() const
Definition Stmt.h:3869
CompoundStmt * getTryBlock() const
Definition Stmt.h:3855
static bool classof(const Stmt *T)
Definition Stmt.h:3873
SourceLocation getTryLoc() const
Definition Stmt.h:3850
bool getIsCXXTry() const
Definition Stmt.h:3853
SEHFinallyStmt * getFinallyHandler() const
friend class ASTReader
Definition Stmt.h:3827
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:3848
friend class ASTStmtReader
Definition Stmt.h:3828
SourceLocation getEndLoc() const
Definition Stmt.h:3851
SEHExceptStmt * getExceptHandler() const
Returns 0 if not defined.
Stmt * getHandler() const
Definition Stmt.h:3859
Encodes a location in the source.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
friend class ArraySubscriptExpr
Definition Stmt.h:541
friend class MatrixSingleSubscriptExpr
Definition Stmt.h:543
friend class MatrixSubscriptExpr
Definition Stmt.h:542
friend class ArrayTypeTraitExpr
Definition Stmt.h:1210
friend class ASTStmtReader
Definition Stmt.h:1211
friend class ASTStmtReader
Definition Stmt.h:170
friend class AttributedStmt
Definition Stmt.h:171
friend class BinaryOperator
Definition Stmt.h:649
friend class CXXBoolLiteralExpr
Definition Stmt.h:801
friend class CXXConstructExpr
Definition Stmt.h:1016
friend class ASTStmtReader
Definition Stmt.h:1015
friend class CXXDefaultArgExpr
Definition Stmt.h:860
friend class ASTStmtReader
Definition Stmt.h:859
friend class ASTStmtReader
Definition Stmt.h:874
friend class CXXDefaultInitExpr
Definition Stmt.h:875
friend class CXXDeleteExpr
Definition Stmt.h:947
friend class ASTStmtReader
Definition Stmt.h:946
friend class CXXDependentScopeMemberExpr
Definition Stmt.h:1066
friend class ASTStmtReader
Definition Stmt.h:1065
friend class CXXFoldExpr
Definition Stmt.h:1236
friend class ASTStmtWriter
Definition Stmt.h:1238
friend class ASTStmtReader
Definition Stmt.h:1237
friend class ASTStmtWriter
Definition Stmt.h:901
friend class CXXNewExpr
Definition Stmt.h:902
friend class ASTStmtReader
Definition Stmt.h:900
friend class ASTStmtReader
Definition Stmt.h:1149
friend class CXXNoexceptExpr
Definition Stmt.h:1150
friend class CXXNullPtrLiteralExpr
Definition Stmt.h:815
friend class CXXOperatorCallExpr
Definition Stmt.h:778
friend class ASTStmtReader
Definition Stmt.h:777
friend class CXXRewrittenBinaryOperator
Definition Stmt.h:791
friend class ASTStmtReader
Definition Stmt.h:790
friend class CXXScalarValueInitExpr
Definition Stmt.h:891
friend class ASTStmtReader
Definition Stmt.h:890
friend class CXXThisExpr
Definition Stmt.h:825
friend class CXXThrowExpr
Definition Stmt.h:845
friend class ASTStmtReader
Definition Stmt.h:844
friend class CXXUnresolvedConstructExpr
Definition Stmt.h:1055
friend class ASTStmtReader
Definition Stmt.h:1054
friend class CallExpr
Definition Stmt.h:552
friend class ImplicitCastExpr
Definition Stmt.h:629
friend class CastExpr
Definition Stmt.h:628
friend class CharacterLiteral
Definition Stmt.h:499
friend class ChooseExpr
Definition Stmt.h:765
friend class ASTStmtReader
Definition Stmt.h:764
friend class CoawaitExpr
Definition Stmt.h:1263
friend class CompoundStmt
Definition Stmt.h:147
friend class ASTStmtReader
Definition Stmt.h:146
friend class ConstantExpr
Definition Stmt.h:371
friend class ASTStmtWriter
Definition Stmt.h:370
friend class ASTStmtReader
Definition Stmt.h:369
friend class ConvertVectorExpr
Definition Stmt.h:1302
friend class DeclRefExpr
Definition Stmt.h:431
friend class ASTStmtReader
Definition Stmt.h:430
friend class DeferStmt
Definition Stmt.h:321
friend class DependentScopeDeclRefExpr
Definition Stmt.h:1003
friend class ASTStmtWriter
Definition Stmt.h:1002
friend class ASTStmtReader
Definition Stmt.h:1001
friend class DoStmt
Definition Stmt.h:250
friend class BlockDeclRefExpr
Definition Stmt.h:335
friend class ParenListExpr
Definition Stmt.h:352
friend class DesignatedInitExpr
Definition Stmt.h:343
friend class PseudoObjectExpr
Definition Stmt.h:353
friend class ObjCMessageExpr
Definition Stmt.h:348
friend class ObjCDictionaryLiteral
Definition Stmt.h:347
friend class ObjCArrayLiteral
Definition Stmt.h:346
friend class DeclRefExpr
Definition Stmt.h:341
friend class CXXDependentScopeMemberExpr
Definition Stmt.h:338
friend class CXXConstructExpr
Definition Stmt.h:337
friend class OpaqueValueExpr
Definition Stmt.h:350
friend class DependentScopeDeclRefExpr
Definition Stmt.h:342
friend class AtomicExpr
Definition Stmt.h:334
friend class Expr
Definition Stmt.h:344
friend class CallExpr
Definition Stmt.h:336
friend class CXXUnresolvedConstructExpr
Definition Stmt.h:340
friend class InitListExpr
Definition Stmt.h:345
friend class CXXNewExpr
Definition Stmt.h:339
friend class ASTStmtReader
Definition Stmt.h:333
friend class OverloadExpr
Definition Stmt.h:351
friend class OffsetOfExpr
Definition Stmt.h:349
friend class ShuffleVectorExpr
Definition Stmt.h:354
friend class ExprWithCleanups
Definition Stmt.h:1041
friend class ASTStmtReader
Definition Stmt.h:1040
friend class ExpressionTraitExpr
Definition Stmt.h:1221
friend class ASTStmtReader
Definition Stmt.h:1222
friend class FloatingLiteral
Definition Stmt.h:459
friend class ForStmt
Definition Stmt.h:260
friend class GenericSelectionExpr
Definition Stmt.h:696
friend class ASTStmtReader
Definition Stmt.h:695
friend class GotoStmt
Definition Stmt.h:270
friend class IndirectGotoStmt
Definition Stmt.h:271
friend class IfStmt
Definition Stmt.h:185
friend class ASTStmtReader
Definition Stmt.h:184
friend class InitListExpr
Definition Stmt.h:672
friend class LabelStmt
Definition Stmt.h:161
friend class LambdaExpr
Definition Stmt.h:1173
friend class ASTStmtWriter
Definition Stmt.h:1172
friend class ASTStmtReader
Definition Stmt.h:1171
friend class LoopControlStmt
Definition Stmt.h:281
friend class MemberExpr
Definition Stmt.h:586
friend class ASTStmtReader
Definition Stmt.h:585
friend class NullStmt
Definition Stmt.h:128
friend class ASTStmtWriter
Definition Stmt.h:127
friend class ASTStmtReader
Definition Stmt.h:126
friend class ObjCIndirectCopyRestoreExpr
Definition Stmt.h:1275
friend class OpaqueValueExpr
Definition Stmt.h:1288
friend class ASTStmtReader
Definition Stmt.h:1287
friend class ASTStmtReader
Definition Stmt.h:1091
friend class OverloadExpr
Definition Stmt.h:1092
friend class PackIndexingExpr
Definition Stmt.h:1247
friend class ASTStmtWriter
Definition Stmt.h:1248
friend class ASTStmtReader
Definition Stmt.h:1249
friend class ParenExpr
Definition Stmt.h:732
friend class ASTStmtWriter
Definition Stmt.h:731
friend class ASTStmtReader
Definition Stmt.h:730
friend class ParenListExpr
Definition Stmt.h:685
friend class ASTStmtReader
Definition Stmt.h:684
friend class PredefinedExpr
Definition Stmt.h:407
friend class ASTStmtReader
Definition Stmt.h:406
friend class PseudoObjectExpr
Definition Stmt.h:707
friend class ASTStmtReader
Definition Stmt.h:706
friend class RequiresExpr
Definition Stmt.h:1199
friend class ASTStmtWriter
Definition Stmt.h:1198
friend class ASTStmtReader
Definition Stmt.h:1197
friend class ReturnStmt
Definition Stmt.h:291
friend class ShuffleVectorExpr
Definition Stmt.h:742
friend class SourceLocExpr
Definition Stmt.h:718
friend class ASTStmtReader
Definition Stmt.h:717
friend class Stmt
Definition Stmt.h:118
friend class ASTStmtWriter
Definition Stmt.h:117
friend class ASTStmtReader
Definition Stmt.h:116
friend class StmtExpr
Definition Stmt.h:752
friend class ASTStmtReader
Definition Stmt.h:751
friend class StringLiteral
Definition Stmt.h:475
friend class ASTStmtReader
Definition Stmt.h:474
friend class SubstNonTypeTemplateParmExpr
Definition Stmt.h:1161
friend class ASTStmtReader
Definition Stmt.h:1160
friend class SwitchCase
Definition Stmt.h:305
friend class CaseStmt
Definition Stmt.h:306
friend class SwitchStmt
Definition Stmt.h:211
friend class TypeTraitExpr
Definition Stmt.h:978
friend class ASTStmtWriter
Definition Stmt.h:977
friend class ASTStmtReader
Definition Stmt.h:976
friend class UnaryExprOrTypeTraitExpr
Definition Stmt.h:529
friend class UnaryOperator
Definition Stmt.h:509
friend class UnresolvedLookupExpr
Definition Stmt.h:1114
friend class ASTStmtReader
Definition Stmt.h:1113
friend class UnresolvedMemberExpr
Definition Stmt.h:1130
friend class ASTStmtReader
Definition Stmt.h:1129
friend class WhileStmt
Definition Stmt.h:236
friend class ASTStmtReader
Definition Stmt.h:235
Stmt - This represents one statement.
Definition Stmt.h:85
ExpressionTraitExprBitfields ExpressionTraitExprBits
Definition Stmt.h:1387
LoopControlStmtBitfields LoopControlStmtBits
Definition Stmt.h:1329
SourceLocation getEndLoc() const LLVM_READONLY
void ProcessODRHash(llvm::FoldingSetNodeID &ID, ODRHash &Hash) const
Calculate a unique representation for a statement that is stable across compiler invocations.
StmtClass
Definition Stmt.h:87
@ NoStmtClass
Definition Stmt.h:88
Stmt(const Stmt &)=delete
UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits
Definition Stmt.h:1343
CXXUnresolvedConstructExprBitfields CXXUnresolvedConstructExprBits
Definition Stmt.h:1377
WhileStmtBitfields WhileStmtBits
Definition Stmt.h:1325
SwitchCaseBitfields SwitchCaseBits
Definition Stmt.h:1331
GenericSelectionExprBitfields GenericSelectionExprBits
Definition Stmt.h:1351
InitListExprBitfields InitListExprBits
Definition Stmt.h:1349
static void EnableStatistics()
LambdaExprBitfields LambdaExprBits
Definition Stmt.h:1384
AttributedStmtBitfields AttributedStmtBits
Definition Stmt.h:1322
Stmt(StmtClass SC)
Definition Stmt.h:1475
ParenListExprBitfields ParenListExprBits
Definition Stmt.h:1350
ArrayOrMatrixSubscriptExprBitfields ArrayOrMatrixSubscriptExprBits
Definition Stmt.h:1344
UnresolvedLookupExprBitfields UnresolvedLookupExprBits
Definition Stmt.h:1380
SwitchStmtBitfields SwitchStmtBits
Definition Stmt.h:1324
SubstNonTypeTemplateParmExprBitfields SubstNonTypeTemplateParmExprBits
Definition Stmt.h:1383
CXXNoexceptExprBitfields CXXNoexceptExprBits
Definition Stmt.h:1382
ParenExprBitfields ParenExprBits
Definition Stmt.h:1354
StmtIterator child_iterator
Child Iterators: All subclasses must implement 'children' to permit easy iteration over the substatem...
Definition Stmt.h:1570
CXXRewrittenBinaryOperatorBitfields CXXRewrittenBinaryOperatorBits
Definition Stmt.h:1363
CallExprBitfields CallExprBits
Definition Stmt.h:1345
Stmt * stripLabelLikeStatements()
Definition Stmt.h:1562
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
CastIterator< T, const T *const, const Stmt *const > ConstCastIterator
Const iterator for iterating over Stmt * arrays that contain only T *.
Definition Stmt.h:1455
const Stmt * stripLabelLikeStatements() const
Strip off all label-like statements.
ShuffleVectorExprBitfields ShuffleVectorExprBits
Definition Stmt.h:1355
ExprWithCleanupsBitfields ExprWithCleanupsBits
Definition Stmt.h:1376
FloatingLiteralBitfields FloatingLiteralBits
Definition Stmt.h:1339
const_child_range children() const
Definition Stmt.h:1578
child_iterator child_begin()
Definition Stmt.h:1582
void printJson(raw_ostream &Out, PrinterHelper *Helper, const PrintingPolicy &Policy, bool AddQuotes) const
Pretty-prints in JSON format.
StmtClass getStmtClass() const
Definition Stmt.h:1484
CXXScalarValueInitExprBitfields CXXScalarValueInitExprBits
Definition Stmt.h:1370
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
CharacterLiteralBitfields CharacterLiteralBits
Definition Stmt.h:1341
OverloadExprBitfields OverloadExprBits
Definition Stmt.h:1379
CXXConstructExprBitfields CXXConstructExprBits
Definition Stmt.h:1375
void printPrettyControlled(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
UnaryOperatorBitfields UnaryOperatorBits
Definition Stmt.h:1342
static std::tuple< bool, const Attr *, const Attr * > determineLikelihoodConflict(const Stmt *Then, const Stmt *Else)
CXXDependentScopeMemberExprBitfields CXXDependentScopeMemberExprBits
Definition Stmt.h:1378
GotoStmtBitfields GotoStmtBits
Definition Stmt.h:1328
child_iterator child_end()
Definition Stmt.h:1583
ConstCastIterator< Expr > ConstExprIterator
Definition Stmt.h:1458
TypeTraitExprBitfields TypeTraitExprBits
Definition Stmt.h:1373
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const
Produce a unique representation of the given statement.
CXXNewExprBitfields CXXNewExprBits
Definition Stmt.h:1371
SourceLocExprBitfields SourceLocExprBits
Definition Stmt.h:1353
CXXNullPtrLiteralExprBitfields CXXNullPtrLiteralExprBits
Definition Stmt.h:1365
CoawaitExprBitfields CoawaitBits
Definition Stmt.h:1392
Stmt(StmtClass SC, EmptyShell)
Construct an empty statement.
Definition Stmt.h:1466
ChooseExprBitfields ChooseExprBits
Definition Stmt.h:1359
ConstantExprBitfields ConstantExprBits
Definition Stmt.h:1336
llvm::iterator_range< child_iterator > child_range
Definition Stmt.h:1573
DeferStmtBitfields DeferStmtBits
Definition Stmt.h:1332
CompoundStmtBitfields CompoundStmtBits
Definition Stmt.h:1320
RequiresExprBitfields RequiresExprBits
Definition Stmt.h:1385
CXXFoldExprBitfields CXXFoldExprBits
Definition Stmt.h:1388
StmtExprBitfields StmtExprBits
Definition Stmt.h:1358
StringLiteralBitfields StringLiteralBits
Definition Stmt.h:1340
OpaqueValueExprBitfields OpaqueValueExprBits
Definition Stmt.h:1398
CastExprBitfields CastExprBits
Definition Stmt.h:1347
Likelihood
The likelihood of a branch being taken.
Definition Stmt.h:1427
@ LH_Unlikely
Branch has the [[unlikely]] attribute.
Definition Stmt.h:1428
@ LH_None
No attribute set or branches of the IfStmt have the same attribute.
Definition Stmt.h:1429
@ LH_Likely
Branch has the [[likely]] attribute.
Definition Stmt.h:1431
CXXThrowExprBitfields CXXThrowExprBits
Definition Stmt.h:1367
static void addStmtClass(const StmtClass s)
MemberExprBitfields MemberExprBits
Definition Stmt.h:1346
PackIndexingExprBitfields PackIndexingExprBits
Definition Stmt.h:1389
friend class ASTStmtWriter
Definition Stmt.h:101
ForStmtBitfields ForStmtBits
Definition Stmt.h:1327
@ NumOverloadExprBits
Definition Stmt.h:1110
DeclRefExprBitfields DeclRefExprBits
Definition Stmt.h:1338
const_child_iterator child_end() const
Definition Stmt.h:1586
const char * getStmtClassName() const
ConstStmtIterator const_child_iterator
Definition Stmt.h:1571
void dumpPretty(const ASTContext &Context) const
dumpPretty/printPretty - These two methods do a "pretty print" of the AST back to its original source...
CXXBoolLiteralExprBitfields CXXBoolLiteralExprBits
Definition Stmt.h:1364
CXXOperatorCallExprBitfields CXXOperatorCallExprBits
Definition Stmt.h:1362
CXXDefaultInitExprBitfields CXXDefaultInitExprBits
Definition Stmt.h:1369
Stmt & operator=(const Stmt &)=delete
NullStmtBitfields NullStmtBits
Definition Stmt.h:1319
static const Attr * getLikelihoodAttr(const Stmt *S)
Stmt * IgnoreContainers(bool IgnoreCaptured=false)
Skip no-op (attributed, compound) container stmts and skip captured stmt at the top,...
DependentScopeDeclRefExprBitfields DependentScopeDeclRefExprBits
Definition Stmt.h:1374
friend class ASTStmtReader
Definition Stmt.h:100
ArrayTypeTraitExprBitfields ArrayTypeTraitExprBits
Definition Stmt.h:1386
StmtBitfields StmtBits
Definition Stmt.h:1318
IfStmtBitfields IfStmtBits
Definition Stmt.h:1323
Stmt & operator=(Stmt &&)=delete
PredefinedExprBitfields PredefinedExprBits
Definition Stmt.h:1337
ConvertVectorExprBitfields ConvertVectorExprBits
Definition Stmt.h:1399
@ NumExprBits
Definition Stmt.h:366
int64_t getID(const ASTContext &Context) const
ReturnStmtBitfields ReturnStmtBits
Definition Stmt.h:1330
LabelStmtBitfields LabelStmtBits
Definition Stmt.h:1321
ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits
Definition Stmt.h:1395
SourceLocation getBeginLoc() const LLVM_READONLY
void dumpColor() const
dumpColor - same as dump(), but forces color highlighting.
BinaryOperatorBitfields BinaryOperatorBits
Definition Stmt.h:1348
UnresolvedMemberExprBitfields UnresolvedMemberExprBits
Definition Stmt.h:1381
PseudoObjectExprBitfields PseudoObjectExprBits
Definition Stmt.h:1352
ExprBitfields ExprBits
Definition Stmt.h:1335
void viewAST() const
viewAST - Visualize an AST rooted at this Stmt* using GraphViz.
llvm::iterator_range< const_child_iterator > const_child_range
Definition Stmt.h:1574
const_child_iterator child_begin() const
Definition Stmt.h:1585
CXXDeleteExprBitfields CXXDeleteExprBits
Definition Stmt.h:1372
CXXDefaultArgExprBitfields CXXDefaultArgExprBits
Definition Stmt.h:1368
DoStmtBitfields DoStmtBits
Definition Stmt.h:1326
@ NumCallExprBits
Definition Stmt.h:582
CXXThisExprBitfields CXXThisExprBits
Definition Stmt.h:1366
CastIterator< Expr > ExprIterator
Definition Stmt.h:1457
StringLiteral - This represents a string literal expression, e.g.
SwitchCase * NextSwitchCase
A pointer to the following CaseStmt or DefaultStmt class, used by SwitchStmt.
Definition Stmt.h:1874
void setColonLoc(SourceLocation L)
Definition Stmt.h:1891
static bool classof(const Stmt *T)
Definition Stmt.h:1901
SwitchCase(StmtClass SC, EmptyShell)
Definition Stmt.h:1881
SourceLocation getKeywordLoc() const
Definition Stmt.h:1888
Stmt * getSubStmt()
Definition Stmt.h:2104
SwitchCase(StmtClass SC, SourceLocation KWLoc, SourceLocation ColonLoc)
Definition Stmt.h:1876
void setKeywordLoc(SourceLocation L)
Definition Stmt.h:1889
const Stmt * getSubStmt() const
Definition Stmt.h:1894
void setNextSwitchCase(SwitchCase *SC)
Definition Stmt.h:1886
SourceLocation getColonLoc() const
Definition Stmt.h:1890
SourceLocation getBeginLoc() const
Definition Stmt.h:1898
const SwitchCase * getNextSwitchCase() const
Definition Stmt.h:1884
SourceLocation ColonLoc
The location of the ":".
Definition Stmt.h:1867
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2096
SwitchCase * getNextSwitchCase()
Definition Stmt.h:1885
void setCond(Expr *Cond)
Definition Stmt.h:2571
const Stmt * getInit() const
Definition Stmt.h:2584
SourceLocation getSwitchLoc() const
Definition Stmt.h:2635
void addSwitchCase(SwitchCase *SC)
Definition Stmt.h:2647
void setBody(Stmt *S, SourceLocation SL)
Definition Stmt.h:2642
SourceLocation getLParenLoc() const
Definition Stmt.h:2637
const Expr * getCond() const
Definition Stmt.h:2567
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:2660
void setSwitchLoc(SourceLocation L)
Definition Stmt.h:2636
void setConditionVariableDeclStmt(DeclStmt *CondVar)
Definition Stmt.h:2626
void setBody(Stmt *Body)
Definition Stmt.h:2578
void setRParenLoc(SourceLocation Loc)
Definition Stmt.h:2640
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2665
SourceLocation getRParenLoc() const
Definition Stmt.h:2639
void setInit(Stmt *Init)
Definition Stmt.h:2588
void setConditionVariable(const ASTContext &Ctx, VarDecl *VD)
Set the condition variable in this switch statement.
void setLParenLoc(SourceLocation Loc)
Definition Stmt.h:2638
child_range children()
Definition Stmt.h:2671
const Stmt * getBody() const
Definition Stmt.h:2576
const VarDecl * getConditionVariable() const
Definition Stmt.h:2604
static SwitchStmt * CreateEmpty(const ASTContext &Ctx, bool HasInit, bool HasVar)
Create an empty switch statement optionally with storage for an init expression and a condition varia...
const DeclStmt * getConditionVariableDeclStmt() const
Definition Stmt.h:2620
Expr * getCond()
Definition Stmt.h:2563
bool hasVarStorage() const
True if this SwitchStmt has storage for a condition variable.
Definition Stmt.h:2561
Stmt * getBody()
Definition Stmt.h:2575
const_child_range children() const
Definition Stmt.h:2676
VarDecl * getConditionVariable()
Retrieve the variable declared in this "switch" statement, if any.
Stmt * getInit()
Definition Stmt.h:2580
SourceLocation getBeginLoc() const
Definition Stmt.h:2664
bool hasInitStorage() const
True if this SwitchStmt has storage for an init statement.
Definition Stmt.h:2558
SwitchCase * getSwitchCaseList()
Definition Stmt.h:2631
const SwitchCase * getSwitchCaseList() const
Definition Stmt.h:2632
DeclStmt * getConditionVariableDeclStmt()
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
Definition Stmt.h:2614
void setAllEnumCasesCovered()
Set a flag in the SwitchStmt indicating that if the 'switch (X)' is a switch over an enum value then ...
Definition Stmt.h:2656
void setSwitchCaseList(SwitchCase *SC)
Definition Stmt.h:2633
static bool classof(const Stmt *T)
Definition Stmt.h:2681
Token - This structure provides full information about a lexed token.
Represents a statement that could possibly have a value and type.
Definition Stmt.h:2118
const Expr * getExprStmt() const
Stmt(StmtClass SC, EmptyShell)
Construct an empty statement.
Definition Stmt.h:1466
static bool classof(const Stmt *T)
Definition Stmt.h:2129
Expr * getExprStmt()
Definition Stmt.h:2124
Represents a variable declaration or definition.
Expr * getCond()
Definition Stmt.h:2740
SourceLocation getWhileLoc() const
Definition Stmt.h:2793
void setCond(Expr *Cond)
Definition Stmt.h:2748
SourceLocation getRParenLoc() const
Definition Stmt.h:2798
DeclStmt * getConditionVariableDeclStmt()
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
Definition Stmt.h:2776
void setBody(Stmt *Body)
Definition Stmt.h:2755
void setLParenLoc(SourceLocation L)
Definition Stmt.h:2797
VarDecl * getConditionVariable()
Retrieve the variable declared in this "while" statement, if any.
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2802
void setConditionVariable(const ASTContext &Ctx, VarDecl *V)
Set the condition variable of this while statement.
bool hasVarStorage() const
True if this WhileStmt has storage for a condition variable.
Definition Stmt.h:2738
SourceLocation getLParenLoc() const
Definition Stmt.h:2796
SourceLocation getBeginLoc() const
Definition Stmt.h:2801
const Stmt * getBody() const
Definition Stmt.h:2753
void setRParenLoc(SourceLocation L)
Definition Stmt.h:2799
const VarDecl * getConditionVariable() const
Definition Stmt.h:2766
void setWhileLoc(SourceLocation L)
Definition Stmt.h:2794
const Expr * getCond() const
Definition Stmt.h:2744
static WhileStmt * CreateEmpty(const ASTContext &Ctx, bool HasVar)
Create an empty while statement optionally with storage for a condition variable.
const DeclStmt * getConditionVariableDeclStmt() const
Definition Stmt.h:2782
void setConditionVariableDeclStmt(DeclStmt *CondVar)
Definition Stmt.h:2788
static bool classof(const Stmt *T)
Definition Stmt.h:2806
const_child_range children() const
Definition Stmt.h:2816
child_range children()
Definition Stmt.h:2811
Stmt * getBody()
Definition Stmt.h:2752
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
ConstantResultStorageKind
Describes the kind of result that can be tail-allocated.
ArrayTypeTrait
Names for the array type traits.
ExprDependenceScope::ExprDependence ExprDependence
void initialize(TemplateInstantiationCallbackPtrs &Callbacks, const Sema &TheSema)
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
@ Create
'create' clause, allowed on Compute and Combined constructs, plus 'data', 'enter data',...
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
CapturedRegionKind
The different kinds of captured statement.
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
const FunctionProtoType * T
CastKind
CastKind - The kind of operation required for a conversion.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
U cast(CodeGen::Address addr)
@ Class
The "class" keyword introduces the elaborated-type-specifier.
TypeTrait
Names for traits that operate specifically on types.
CXXNewInitializationStyle
Diagnostic wrappers for TextAPI types for error reporting.
Describes how types, statements, expressions, and declarations should be printed.
Iterator for iterating over Stmt * arrays that contain only T *.
Definition Stmt.h:1442
typename CastIterator::iterator_adaptor_base Base
Definition Stmt.h:1443
CastIterator(StmtPtr *I)
Definition Stmt.h:1446
CastIterator()
Definition Stmt.h:1445
Base::value_type operator*() const
Definition Stmt.h:1448
A placeholder type used to construct an empty shell of a type, that will be filled in later (e....
Definition Stmt.h:1424