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
549
552
555
556 unsigned NumPreArgs : 1;
557
558
559 LLVM_PREFERRED_TYPE(bool)
560 unsigned UsesADL : 1;
561
562
563 LLVM_PREFERRED_TYPE(bool)
564 unsigned HasFPFeatures : 1;
565
566
567 LLVM_PREFERRED_TYPE(bool)
568 unsigned IsCoroElideSafe : 1;
569
570
571
572 LLVM_PREFERRED_TYPE(bool)
573 unsigned ExplicitObjectMemFunUsingMemberSyntax : 1;
574
575
576
577 LLVM_PREFERRED_TYPE(bool)
578 unsigned HasTrailingSourceLoc : 1;
579 };
580
582
586
589
590
591 LLVM_PREFERRED_TYPE(bool)
592 unsigned IsArrow : 1;
593
594
595
596 LLVM_PREFERRED_TYPE(bool)
597 unsigned HasQualifier : 1;
598
599
600 LLVM_PREFERRED_TYPE(bool)
601 unsigned HasFoundDecl : 1;
602
603
604
605
606
607
608 LLVM_PREFERRED_TYPE(bool)
609 unsigned HasTemplateKWAndArgsInfo : 1;
610
611
612
613 LLVM_PREFERRED_TYPE(bool)
614 unsigned HadMultipleCandidates : 1;
615
616
617
618
619 LLVM_PREFERRED_TYPE(NonOdrUseReason)
620 unsigned NonOdrUseReason : 2;
621
622
624 };
625
629
632
633 LLVM_PREFERRED_TYPE(CastKind)
634 unsigned Kind : 7;
635 LLVM_PREFERRED_TYPE(bool)
636 unsigned PartOfExplicitCast : 1;
637
638
639 LLVM_PREFERRED_TYPE(bool)
640 unsigned HasFPFeatures : 1;
641
642
643
644 unsigned BasePathSize;
645 };
646
649
652
654 unsigned Opc : 6;
655
656
657
658
659 LLVM_PREFERRED_TYPE(bool)
660 unsigned HasFPFeatures : 1;
661
662
663
664 LLVM_PREFERRED_TYPE(bool)
665 unsigned ExcludedOverflowPattern : 1;
666
668 };
669
672
675
676
677
678 LLVM_PREFERRED_TYPE(bool)
679 unsigned HadArrayRangeDesignator : 1;
680 };
681
685
688
689
690 unsigned NumExprs;
691 };
692
703
707
710
711 unsigned NumSubExprs : 16;
712 unsigned ResultIndex : 16;
713 };
714
718
721
722
723
725 unsigned Kind : 3;
726 };
727
732
735
736 LLVM_PREFERRED_TYPE(bool)
737 unsigned ProducedByFoldExpansion : 1;
738 };
739
742
745
746 unsigned NumExprs;
747 };
748
752
755
756
757
758
759 unsigned TemplateDepth;
760 };
761
765
768
769 LLVM_PREFERRED_TYPE(bool)
770 bool CondIsTrue : 1;
771 };
772
773
774
778
781
782
783
785 unsigned OperatorKind : 6;
786 };
787
791
794
795 LLVM_PREFERRED_TYPE(bool)
796 unsigned IsReversed : 1;
797 };
798
801
804
805
806 LLVM_PREFERRED_TYPE(bool)
807 unsigned Value : 1;
808
809
811 };
812
822
825
828
829
830 LLVM_PREFERRED_TYPE(bool)
831 unsigned IsImplicit : 1;
832
833
834
835 LLVM_PREFERRED_TYPE(bool)
836 unsigned CapturedByCopyInLambdaWithExplicitObjectParameter : 1;
837
838
840 };
841
845
848
849
850 LLVM_PREFERRED_TYPE(bool)
851 unsigned IsThrownVariableInScope : 1;
852
853
855 };
856
860
863
864
865 LLVM_PREFERRED_TYPE(bool)
866 unsigned HasRewrittenInit : 1;
867
868
870 };
871
875
878
879
880
881 LLVM_PREFERRED_TYPE(bool)
882 unsigned HasRewrittenInit : 1;
883
884
886 };
887
897
902
905
906
907 LLVM_PREFERRED_TYPE(bool)
908 unsigned IsGlobalNew : 1;
909
910
911
912 LLVM_PREFERRED_TYPE(bool)
913 unsigned IsArray : 1;
914
915
916 LLVM_PREFERRED_TYPE(bool)
917 unsigned ShouldPassAlignment : 1;
918
919
920 LLVM_PREFERRED_TYPE(bool)
921 unsigned ShouldPassTypeIdentity : 1;
922
923
924
925 LLVM_PREFERRED_TYPE(bool)
926 unsigned UsualArrayDeleteWantsSize : 1;
927
928
929 LLVM_PREFERRED_TYPE(bool)
930 unsigned HasInitializer : 1;
931
932
934 unsigned StoredInitializationStyle : 2;
935
936
937 LLVM_PREFERRED_TYPE(bool)
938 unsigned IsParenTypeId : 1;
939
940
941 unsigned NumPlacementArgs;
942 };
943
947
950
951
952 LLVM_PREFERRED_TYPE(bool)
953 unsigned GlobalDelete : 1;
954
955
956 LLVM_PREFERRED_TYPE(bool)
957 unsigned ArrayForm : 1;
958
959
960
961
962 LLVM_PREFERRED_TYPE(bool)
963 unsigned ArrayFormAsWritten : 1;
964
965
966
967 LLVM_PREFERRED_TYPE(bool)
968 unsigned UsualArrayDeleteWantsSize : 1;
969
970
972 };
973
978
981
982
984 unsigned Kind : 8;
985
986 LLVM_PREFERRED_TYPE(bool)
987 unsigned IsBooleanTypeTrait : 1;
988
989
990
991 LLVM_PREFERRED_TYPE(bool)
992 unsigned Value : 1;
993
994
995
996 unsigned NumArgs;
997 };
998
1003
1006
1007
1008
1009 LLVM_PREFERRED_TYPE(bool)
1010 unsigned HasTemplateKWAndArgsInfo : 1;
1011 };
1012
1016
1019
1020 LLVM_PREFERRED_TYPE(bool)
1021 unsigned Elidable : 1;
1022 LLVM_PREFERRED_TYPE(bool)
1023 unsigned HadMultipleCandidates : 1;
1024 LLVM_PREFERRED_TYPE(bool)
1025 unsigned ListInitialization : 1;
1026 LLVM_PREFERRED_TYPE(bool)
1027 unsigned StdInitListInitialization : 1;
1028 LLVM_PREFERRED_TYPE(bool)
1029 unsigned ZeroInitialization : 1;
1031 unsigned ConstructionKind : 3;
1032 LLVM_PREFERRED_TYPE(bool)
1033 unsigned IsImmediateEscalating : 1;
1034
1036 };
1037
1041
1044
1045
1046 LLVM_PREFERRED_TYPE(bool)
1047 unsigned CleanupsHaveSideEffects : 1;
1048
1049 unsigned NumObjects : 32 - 1 - NumExprBits;
1050 };
1051
1055
1058
1059
1060 unsigned NumArgs;
1061 };
1062
1066
1069
1070
1071
1072 LLVM_PREFERRED_TYPE(bool)
1073 unsigned IsArrow : 1;
1074
1075
1076
1077 LLVM_PREFERRED_TYPE(bool)
1078 unsigned HasTemplateKWAndArgsInfo : 1;
1079
1080
1081
1082 LLVM_PREFERRED_TYPE(bool)
1083 unsigned HasFirstQualifierFoundInScope : 1;
1084
1085
1087 };
1088
1092
1095
1096
1097
1098 LLVM_PREFERRED_TYPE(bool)
1099 unsigned HasTemplateKWAndArgsInfo : 1;
1100
1101
1102
1103
1105
1106
1107 unsigned NumResults;
1108 };
1110
1114
1117
1118
1119
1120 LLVM_PREFERRED_TYPE(bool)
1121 unsigned RequiresADL : 1;
1122 };
1124 "UnresolvedLookupExprBitfields must be <= than 4 bytes to"
1125 "avoid trashing OverloadExprBitfields::NumResults!");
1126
1130
1133
1134
1135
1136 LLVM_PREFERRED_TYPE(bool)
1137 unsigned IsArrow : 1;
1138
1139
1140 LLVM_PREFERRED_TYPE(bool)
1141 unsigned HasUnresolvedUsing : 1;
1142 };
1144 "UnresolvedMemberExprBitfields must be <= than 4 bytes to"
1145 "avoid trashing OverloadExprBitfields::NumResults!");
1146
1150
1153
1154 LLVM_PREFERRED_TYPE(bool)
1155 unsigned Value : 1;
1156 };
1157
1168
1173
1176
1177
1178
1180 unsigned CaptureDefault : 2;
1181
1182
1183
1184 LLVM_PREFERRED_TYPE(bool)
1185 unsigned ExplicitParams : 1;
1186
1187
1188 LLVM_PREFERRED_TYPE(bool)
1189 unsigned ExplicitResultType : 1;
1190
1191
1192 unsigned NumCaptures : 16;
1193 };
1194
1199
1202
1203 LLVM_PREFERRED_TYPE(bool)
1204 unsigned IsSatisfied : 1;
1206 };
1207
1213
1214
1216 unsigned ATT : 2;
1217 };
1218
1224
1225
1227 unsigned ET : 31;
1228
1229
1230 LLVM_PREFERRED_TYPE(bool)
1231 unsigned Value : 1;
1232 };
1233
1244
1249
1252
1253 unsigned TransformedExpressions : 31;
1254
1255 LLVM_PREFERRED_TYPE(bool)
1256 unsigned FullySubstituted : 1;
1257 };
1258
1259
1260
1263
1266
1267 LLVM_PREFERRED_TYPE(bool)
1268 unsigned IsImplicit : 1;
1269 };
1270
1271
1272
1275
1278
1279 LLVM_PREFERRED_TYPE(bool)
1280 unsigned ShouldCopy : 1;
1281 };
1282
1283
1284
1288
1291
1292
1293
1294 LLVM_PREFERRED_TYPE(bool)
1295 unsigned IsUnique : 1;
1296
1298 };
1299
1302
1305
1306
1307
1308
1309
1310 LLVM_PREFERRED_TYPE(bool)
1311 unsigned HasFPFeatures : 1;
1312 };
1313
1314 union {
1315
1316
1332
1333
1355
1356
1359
1360
1389
1390
1392
1393
1395
1396
1399 };
1400
1401public:
1402
1403
1405 unsigned alignment = 8);
1406
1408 unsigned alignment = 8) {
1409 return operator new(bytes, *C, alignment);
1410 }
1411
1412 void *operator new(size_t bytes, void *mem) noexcept { return mem; }
1413
1416 void operator delete(void *, size_t) noexcept {}
1417 void operator delete(void *, void *) noexcept {}
1418
1419public:
1420
1421
1422
1424
1425
1432
1433protected:
1434
1435
1436
1437
1438 template<typename T, typename TPtr = T *, typename StmtPtr = Stmt *>
1440 : llvm::iterator_adaptor_base<CastIterator<T, TPtr, StmtPtr>, StmtPtr *,
1441 std::random_access_iterator_tag, TPtr> {
1442 using Base = typename CastIterator::iterator_adaptor_base;
1443
1446
1448 return cast_or_null(*this->I);
1449 }
1450 };
1451
1452
1453 template
1455
1458
1459private:
1460
1461 static bool StatisticsEnabled;
1462
1463protected:
1464
1466
1467public:
1473
1475 static_assert(sizeof(*this) <= 8,
1476 "changing bitfields changed sizeof(Stmt)");
1477 static_assert(sizeof(*this) % alignof(void *) == 0,
1478 "Insufficient alignment!");
1481 }
1482
1486
1488
1489
1490
1491
1495
1496
1500
1501
1503
1504
1506
1507
1509
1510
1511
1512
1514
1515
1516
1517
1518 static std::tuple<bool, const Attr *, const Attr *>
1520
1521
1522
1523 void dump() const;
1524 void dump(raw_ostream &OS, const ASTContext &Context) const;
1525
1526
1528
1529
1531
1532
1533
1536 const PrintingPolicy &Policy, unsigned Indentation = 0,
1537 StringRef NewlineSymbol = "\n",
1538 const ASTContext *Context = nullptr) const;
1541 unsigned Indentation = 0,
1542 StringRef NewlineSymbol = "\n",
1543 const ASTContext *Context = nullptr) const;
1544
1545
1547 const PrintingPolicy &Policy, bool AddQuotes) const;
1548
1549
1550
1552
1553
1554
1557 return const_cast<Stmt *>(this)->IgnoreContainers(IgnoreCaptured);
1558 }
1559
1562 return const_cast<Stmt*>(
1563 const_cast<const Stmt*>(this)->stripLabelLikeStatements());
1564 }
1565
1566
1567
1568
1571
1572 using child_range = llvm::iterator_range<child_iterator>;
1574
1576
1580
1583
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604 void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context,
1605 bool Canonical, bool ProfileLambdaExpr = false) const;
1606
1607
1608
1609
1610
1611
1612
1613
1615};
1616
1617
1618
1619
1620
1624
1625public:
1627 : Stmt(DeclStmtClass), DG(dg), StartLoc(startLoc), EndLoc(endLoc) {}
1628
1629
1631
1632
1633
1635
1638
1642
1646
1648
1650 return T->getStmtClass() == DeclStmtClass;
1651 }
1652
1653
1658
1663
1666 using decl_range = llvm::iterator_range<decl_iterator>;
1668
1670
1674
1679
1681
1685
1689};
1690
1691
1692
1694public:
1696 : Stmt(NullStmtClass) {
1699 }
1700
1701
1703
1706
1710
1713
1715 return T->getStmtClass() == NullStmtClass;
1716 }
1717
1721
1725};
1726
1727
1728class CompoundStmt final
1729 : public Stmt,
1730 private llvm::TrailingObjects<CompoundStmt, Stmt *, FPOptionsOverride> {
1732 friend TrailingObjects;
1733
1734
1736
1737
1739
1743
1745
1746
1749 *getTrailingObjects() = F;
1750 }
1751
1752 size_t numTrailingObjects(OverloadToken<Stmt *>) const {
1754 }
1755
1756public:
1757 static CompoundStmt *Create(const ASTContext &C, ArrayRef<Stmt *> Stmts,
1758 FPOptionsOverride FPFeatures, SourceLocation LB,
1759 SourceLocation RB);
1760
1761
1763
1765 : Stmt(CompoundStmtClass), LBraceLoc(Loc), RBraceLoc(EndLoc) {
1768 }
1769
1770
1772 bool HasFPFeatures);
1773
1776
1778
1779
1782 return *getTrailingObjects();
1783 }
1784
1785
1789
1791 using body_range = llvm::iterator_range<body_iterator>;
1792
1797
1801
1804
1808
1810 return getTrailingObjects<Stmt *>();
1811 }
1812
1814
1818
1822
1824
1828
1832
1834 std::reverse_iterator<const_body_iterator>;
1835
1839
1843
1846
1849
1851 return T->getStmtClass() == CompoundStmtClass;
1852 }
1853
1854
1856
1860};
1861
1862
1864protected:
1865
1867
1868
1869
1870
1871
1872
1874
1879
1881
1882public:
1886
1891
1896
1899
1901 return T->getStmtClass() == CaseStmtClass ||
1902 T->getStmtClass() == DefaultStmtClass;
1903 }
1904};
1905
1906
1907
1908class CaseStmt final
1910 private llvm::TrailingObjects<CaseStmt, Stmt *, SourceLocation> {
1911 friend TrailingObjects;
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928 enum { LhsOffset = 0, SubStmtOffsetFromRhs = 1 };
1929 enum { NumMandatoryStmtPtr = 2 };
1930
1931 unsigned numTrailingObjects(OverloadToken<Stmt *>) const {
1933 }
1934
1935 unsigned lhsOffset() const { return LhsOffset; }
1936 unsigned rhsOffset() const { return LhsOffset + caseStmtIsGNURange(); }
1937 unsigned subStmtOffset() const { return rhsOffset() + SubStmtOffsetFromRhs; }
1938
1939
1940
1943 : SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
1944
1945 bool IsGNURange = rhs != nullptr;
1949 if (IsGNURange) {
1952 }
1953 }
1954
1955
1956 explicit CaseStmt(EmptyShell Empty, bool CaseStmtIsGNURange)
1958 SwitchCaseBits.CaseStmtIsGNURange = CaseStmtIsGNURange;
1959 }
1960
1961public:
1962
1966
1967
1969
1970
1971
1972
1974
1977
1978
1983
1984
1985
1987 assert(
1989 "setEllipsisLoc but this is not a case stmt of the form LHS ... RHS!");
1990 *getTrailingObjects() = L;
1991 }
1992
1994 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1995 }
1996
1998 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1999 }
2000
2002 getTrailingObjects<Stmt *>()[lhsOffset()] = reinterpret_cast<Stmt *>(Val);
2003 }
2004
2007 getTrailingObjects<Stmt *>()[rhsOffset()])
2008 : nullptr;
2009 }
2010
2013 getTrailingObjects<Stmt *>()[rhsOffset()])
2014 : nullptr;
2015 }
2016
2019 "setRHS but this is not a case stmt of the form LHS ... RHS!");
2020 getTrailingObjects<Stmt *>()[rhsOffset()] = reinterpret_cast<Stmt *>(Val);
2021 }
2022
2023 Stmt *getSubStmt() { return getTrailingObjects<Stmt *>()[subStmtOffset()]; }
2025 return getTrailingObjects<Stmt *>()[subStmtOffset()];
2026 }
2027
2029 getTrailingObjects<Stmt *>()[subStmtOffset()] = S;
2030 }
2031
2034
2035 const CaseStmt *CS = this;
2036 while (const auto *CS2 = dyn_cast(CS->getSubStmt()))
2037 CS = CS2;
2038
2040 }
2041
2043 return T->getStmtClass() == CaseStmtClass;
2044 }
2045
2046
2048 return child_range(getTrailingObjects<Stmt *>(),
2049 getTrailingObjects<Stmt *>() +
2050 numTrailingObjects(OverloadToken<Stmt *>()));
2051 }
2052
2055 getTrailingObjects<Stmt *>() +
2056 numTrailingObjects(OverloadToken<Stmt *>()));
2057 }
2058};
2059
2061 Stmt *SubStmt;
2062
2063public:
2065 : SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {}
2066
2067
2070
2074
2077
2080 return SubStmt->getEndLoc();
2081 }
2082
2084 return T->getStmtClass() == DefaultStmtClass;
2085 }
2086
2087
2089
2093};
2094
2096 if (const auto *CS = dyn_cast(this))
2097 return CS->getEndLoc();
2098 else if (const auto *DS = dyn_cast(this))
2099 return DS->getEndLoc();
2100 llvm_unreachable("SwitchCase is neither a CaseStmt nor a DefaultStmt!");
2101}
2102
2104 if (auto *CS = dyn_cast(this))
2105 return CS->getSubStmt();
2106 else if (auto *DS = dyn_cast(this))
2107 return DS->getSubStmt();
2108 llvm_unreachable("SwitchCase is neither a CaseStmt nor a DefaultStmt!");
2109}
2110
2111
2112
2113
2114
2115
2116
2118protected:
2120
2121public:
2124 const ValueStmt *ConstThis = this;
2126 }
2127
2129 return T->getStmtClass() >= firstValueStmtConstant &&
2130 T->getStmtClass() <= lastValueStmtConstant;
2131 }
2132};
2133
2134
2135
2138 Stmt *SubStmt;
2139 bool SideEntry = false;
2140
2141public:
2142
2144 : ValueStmt(LabelStmtClass), TheDecl(D), SubStmt(substmt) {
2146 }
2147
2148
2150
2153
2156
2157 const char *getName() const;
2159
2162
2165
2166
2167
2170 return const_cast<Stmt *>(
2171 const_cast<const LabelStmt *>(this)->getInnermostLabeledStmt());
2172 }
2173
2175
2179
2181 return T->getStmtClass() == LabelStmtClass;
2182 }
2185};
2186
2187
2188
2189
2190
2191class AttributedStmt final
2193 private llvm::TrailingObjects<AttributedStmt, const Attr *> {
2195 friend TrailingObjects;
2196
2197 Stmt *SubStmt;
2198
2200 Stmt *SubStmt)
2201 : ValueStmt(AttributedStmtClass), SubStmt(SubStmt) {
2204 llvm::copy(Attrs, getAttrArrayPtr());
2205 }
2206
2211 std::fill_n(getAttrArrayPtr(), NumAttrs, nullptr);
2212 }
2213
2214 const Attr *const *getAttrArrayPtr() const { return getTrailingObjects(); }
2215 const Attr **getAttrArrayPtr() { return getTrailingObjects(); }
2216
2217public:
2218 static AttributedStmt *Create(const ASTContext &C, SourceLocation Loc,
2219 ArrayRef<const Attr *> Attrs, Stmt *SubStmt);
2220
2221
2222 static AttributedStmt *CreateEmpty(const ASTContext &C, unsigned NumAttrs);
2223
2228
2231
2234
2236
2240
2242 return T->getStmtClass() == AttributedStmtClass;
2243 }
2244};
2245
2246
2247class IfStmt final
2248 : public Stmt,
2249 private llvm::TrailingObjects<IfStmt, Stmt *, SourceLocation> {
2250 friend TrailingObjects;
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274 enum { InitOffset = 0, ThenOffsetFromCond = 1, ElseOffsetFromCond = 2 };
2275 enum { NumMandatoryStmtPtr = 2 };
2278
2279 unsigned numTrailingObjects(OverloadToken<Stmt *>) const {
2282 }
2283
2284 unsigned numTrailingObjects(OverloadToken) const {
2286 }
2287
2288 unsigned initOffset() const { return InitOffset; }
2289 unsigned varOffset() const { return InitOffset + hasInitStorage(); }
2290 unsigned condOffset() const {
2292 }
2293 unsigned thenOffset() const { return condOffset() + ThenOffsetFromCond; }
2294 unsigned elseOffset() const { return condOffset() + ElseOffsetFromCond; }
2295
2296
2300
2301
2302 explicit IfStmt(EmptyShell Empty, bool HasElse, bool HasVar, bool HasInit);
2303
2304public:
2305
2310 Stmt *Else = nullptr);
2311
2312
2313
2315 bool HasInit);
2316
2317
2319
2320
2322
2323
2325
2327 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
2328 }
2329
2331 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
2332 }
2333
2335 getTrailingObjects<Stmt *>()[condOffset()] = reinterpret_cast<Stmt *>(Cond);
2336 }
2337
2338 Stmt *getThen() { return getTrailingObjects<Stmt *>()[thenOffset()]; }
2340 return getTrailingObjects<Stmt *>()[thenOffset()];
2341 }
2342
2344 getTrailingObjects<Stmt *>()[thenOffset()] = Then;
2345 }
2346
2348 return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
2349 : nullptr;
2350 }
2351
2353 return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
2354 : nullptr;
2355 }
2356
2359 "This if statement has no storage for an else statement!");
2360 getTrailingObjects<Stmt *>()[elseOffset()] = Else;
2361 }
2362
2363
2364
2365
2366
2367
2368
2369
2370
2375
2376
2377
2379
2380
2381
2384 getTrailingObjects<Stmt *>()[varOffset()])
2385 : nullptr;
2386 }
2387
2390 getTrailingObjects<Stmt *>()[varOffset()])
2391 : nullptr;
2392 }
2393
2396 getTrailingObjects<Stmt *>()[varOffset()] = CondVar;
2397 }
2398
2400 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2401 : nullptr;
2402 }
2403
2405 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2406 : nullptr;
2407 }
2408
2411 "This if statement has no storage for an init statement!");
2412 getTrailingObjects<Stmt *>()[initOffset()] = Init;
2413 }
2414
2417
2419 return hasElseStorage() ? *getTrailingObjects()
2421 }
2422
2425 "This if statement has no storage for an else statement!");
2426 *getTrailingObjects() = ElseLoc;
2427 }
2428
2433
2437
2441
2445
2447 IfStmtBits.Kind = static_cast<unsigned>(Kind);
2448 }
2449
2453
2454
2455
2458
2460
2471
2472
2473
2475
2476
2477 return child_range(getTrailingObjects<Stmt *>() +
2479 getTrailingObjects<Stmt *>() +
2480 numTrailingObjects(OverloadToken<Stmt *>()));
2481 }
2482
2484
2485
2488 getTrailingObjects<Stmt *>() +
2489 numTrailingObjects(OverloadToken<Stmt *>()));
2490 }
2491
2493 return T->getStmtClass() == IfStmtClass;
2494 }
2495};
2496
2497
2498class SwitchStmt final : public Stmt,
2499 private llvm::TrailingObjects<SwitchStmt, Stmt *> {
2500 friend TrailingObjects;
2501
2502
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522 enum { InitOffset = 0, BodyOffsetFromCond = 1 };
2523 enum { NumMandatoryStmtPtr = 2 };
2526
2527 unsigned numTrailingStatements() const {
2529 }
2530
2531 unsigned initOffset() const { return InitOffset; }
2532 unsigned varOffset() const { return InitOffset + hasInitStorage(); }
2533 unsigned condOffset() const {
2535 }
2536 unsigned bodyOffset() const { return condOffset() + BodyOffsetFromCond; }
2537
2538
2541
2542
2543 explicit SwitchStmt(EmptyShell Empty, bool HasInit, bool HasVar);
2544
2545public:
2546
2550
2551
2552
2554 bool HasVar);
2555
2556
2558
2559
2561
2563 return reinterpret_cast<Expr *>(getTrailingObjects()[condOffset()]);
2564 }
2565
2567 return reinterpret_cast<Expr *>(getTrailingObjects()[condOffset()]);
2568 }
2569
2571 getTrailingObjects()[condOffset()] = reinterpret_cast<Stmt *>(Cond);
2572 }
2573
2574 Stmt *getBody() { return getTrailingObjects()[bodyOffset()]; }
2575 const Stmt *getBody() const { return getTrailingObjects()[bodyOffset()]; }
2576
2577 void setBody(Stmt *Body) { getTrailingObjects()[bodyOffset()] = Body; }
2578
2580 return hasInitStorage() ? getTrailingObjects()[initOffset()] : nullptr;
2581 }
2582
2584 return hasInitStorage() ? getTrailingObjects()[initOffset()] : nullptr;
2585 }
2586
2589 "This switch statement has no storage for an init statement!");
2590 getTrailingObjects()[initOffset()] = Init;
2591 }
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2606
2607
2608
2610
2611
2612
2615 ? static_cast<DeclStmt *>(getTrailingObjects()[varOffset()])
2616 : nullptr;
2617 }
2618
2621 ? static_cast<DeclStmt *>(getTrailingObjects()[varOffset()])
2622 : nullptr;
2623 }
2624
2627 getTrailingObjects()[varOffset()] = CondVar;
2628 }
2629
2633
2640
2645
2648 "case/default already added to a switch");
2650 FirstCase = SC;
2651 }
2652
2653
2654
2656
2657
2658
2662
2668
2669
2671 return child_range(getTrailingObjects(),
2672 getTrailingObjects() + numTrailingStatements());
2673 }
2674
2677 getTrailingObjects() + numTrailingStatements());
2678 }
2679
2681 return T->getStmtClass() == SwitchStmtClass;
2682 }
2683};
2684
2685
2686class WhileStmt final : public Stmt,
2687 private llvm::TrailingObjects<WhileStmt, Stmt *> {
2688 friend TrailingObjects;
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705 enum { VarOffset = 0, BodyOffsetFromCond = 1 };
2706 enum { NumMandatoryStmtPtr = 2 };
2707
2709
2710 unsigned varOffset() const { return VarOffset; }
2711 unsigned condOffset() const { return VarOffset + hasVarStorage(); }
2712 unsigned bodyOffset() const { return condOffset() + BodyOffsetFromCond; }
2713
2714 unsigned numTrailingStatements() const {
2716 }
2717
2718
2722
2723
2725
2726public:
2727
2731
2732
2733
2735
2736
2738
2740 return reinterpret_cast<Expr *>(getTrailingObjects()[condOffset()]);
2741 }
2742
2744 return reinterpret_cast<Expr *>(getTrailingObjects()[condOffset()]);
2745 }
2746
2748 getTrailingObjects()[condOffset()] = reinterpret_cast<Stmt *>(Cond);
2749 }
2750
2751 Stmt *getBody() { return getTrailingObjects()[bodyOffset()]; }
2752 const Stmt *getBody() const { return getTrailingObjects()[bodyOffset()]; }
2753
2754 void setBody(Stmt *Body) { getTrailingObjects()[bodyOffset()] = Body; }
2755
2756
2757
2758
2759
2760
2761
2762
2763
2768
2769
2770
2772
2773
2774
2777 ? static_cast<DeclStmt *>(getTrailingObjects()[varOffset()])
2778 : nullptr;
2779 }
2780
2783 ? static_cast<DeclStmt *>(getTrailingObjects()[varOffset()])
2784 : nullptr;
2785 }
2786
2789 getTrailingObjects()[varOffset()] = CondVar;
2790 }
2791
2794
2799
2804
2806 return T->getStmtClass() == WhileStmtClass;
2807 }
2808
2809
2811 return child_range(getTrailingObjects(),
2812 getTrailingObjects() + numTrailingStatements());
2813 }
2814
2817 getTrailingObjects() + numTrailingStatements());
2818 }
2819};
2820
2821
2823 enum { BODY, COND, END_EXPR };
2824 Stmt *SubExprs[END_EXPR];
2826 SourceLocation RParenLoc;
2827
2828public:
2831 : Stmt(DoStmtClass), WhileLoc(WL), RParenLoc(RP) {
2835 }
2836
2837
2839
2842 return reinterpret_cast<Expr *>(SubExprs[COND]);
2843 }
2844
2846
2850
2857
2860
2862 return T->getStmtClass() == DoStmtClass;
2863 }
2864
2865
2867 return child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2868 }
2869
2873};
2874
2875
2876
2877
2880
2881 enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
2882 Stmt* SubExprs[END_EXPR];
2884
2885public:
2889
2890
2892
2894
2895
2896
2897
2898
2899
2900
2901
2902
2905
2906
2907
2909 return reinterpret_cast<DeclStmt*>(SubExprs[CONDVAR]);
2910 }
2911
2913 return reinterpret_cast<DeclStmt*>(SubExprs[CONDVAR]);
2914 }
2915
2917 SubExprs[CONDVAR] = CondVar;
2918 }
2919
2923
2925 const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
2926 const Expr *getInc() const { return reinterpret_cast<Expr*>(SubExprs[INC]); }
2928
2931 void setInc(Expr *E) { SubExprs[INC] = reinterpret_cast<Stmt*>(E); }
2933
2940
2943
2945 return T->getStmtClass() == ForStmtClass;
2946 }
2947
2948
2950 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2951 }
2952
2956};
2957
2958
2962
2963public:
2965 : Stmt(GotoStmtClass), Label(label), LabelLoc(LL) {
2967 }
2968
2969
2971
2974
2979
2982
2984 return T->getStmtClass() == GotoStmtClass;
2985 }
2986
2987
2991
2995};
2996
2997
3000 Stmt *Target;
3001
3002public:
3004 : Stmt(IndirectGotoStmtClass), StarLoc(starLoc) {
3007 }
3008
3009
3012
3017
3020 return reinterpret_cast<const Expr *>(Target);
3021 }
3023
3024
3025
3030
3033
3035 return T->getStmtClass() == IndirectGotoStmtClass;
3036 }
3037
3038
3040
3044};
3045
3046
3048
3049
3050
3051
3052
3053
3054
3055
3056 LabelDecl *TargetLabel = nullptr;
3058
3059protected:
3065
3068
3070
3071public:
3074
3079
3081
3084
3088
3089
3090
3092
3093
3097
3101
3104 return Class == ContinueStmtClass || Class == BreakStmtClass;
3105 }
3106};
3107
3108
3110public:
3114
3115
3118
3120 return T->getStmtClass() == ContinueStmtClass;
3121 }
3122};
3123
3124
3126public:
3130
3131
3134
3136 return T->getStmtClass() == BreakStmtClass;
3137 }
3138};
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148class ReturnStmt final
3149 : public Stmt,
3150 private llvm::TrailingObjects<ReturnStmt, const VarDecl *> {
3151 friend TrailingObjects;
3152
3153
3154 Stmt *RetExpr;
3155
3156
3157
3158
3159
3160 bool hasNRVOCandidate() const { return ReturnStmtBits.HasNRVOCandidate; }
3161
3162
3164
3165
3166 explicit ReturnStmt(EmptyShell Empty, bool HasNRVOCandidate);
3167
3168public:
3169
3171 const VarDecl *NRVOCandidate);
3172
3173
3174
3176
3180
3181
3182
3183
3184
3185
3187 return hasNRVOCandidate() ? *getTrailingObjects() : nullptr;
3188 }
3189
3190
3191
3192
3194 assert(hasNRVOCandidate() &&
3195 "This return statement has no storage for an NRVO candidate!");
3196 *getTrailingObjects() = Var;
3197 }
3198
3201
3204 return RetExpr ? RetExpr->getEndLoc() : getReturnLoc();
3205 }
3206
3208 return T->getStmtClass() == ReturnStmtClass;
3209 }
3210
3211
3213 if (RetExpr)
3214 return child_range(&RetExpr, &RetExpr + 1);
3216 }
3217
3223};
3224
3225
3226class DeferStmt : public Stmt {
3228
3229
3231
3234
3235public:
3238 Stmt *Body);
3239
3244
3248 assert(S && "defer body must not be null");
3249 Body = S;
3250 }
3251
3254
3256
3260
3264};
3265
3266
3268protected:
3270
3272
3273
3274
3276
3277
3278
3280
3284
3286
3288 unsigned numoutputs, unsigned numinputs, unsigned numclobbers)
3292
3293public:
3294
3296
3299
3302
3305
3308
3309
3310
3311
3313
3314
3315
3317
3318
3319
3320
3322
3323
3324
3325
3329
3331
3332
3333
3335
3336
3337
3339
3340
3341
3343
3345
3346
3347
3349 std::string getClobber(unsigned i) const;
3350
3352 return T->getStmtClass() == GCCAsmStmtClass ||
3353 T->getStmtClass() == MSAsmStmtClass;
3354 }
3355
3356
3357
3362
3366
3370
3372
3376
3380
3384
3385
3386
3391
3393 return &Exprs[0];
3394 }
3395
3399
3403
3405 return &Exprs[0];
3406 }
3407
3411
3415
3419
3423};
3424
3425
3428
3430 Expr *AsmStr;
3431
3432
3433 Expr **Constraints = nullptr;
3434 Expr **Clobbers = nullptr;
3436 unsigned NumLabels = 0;
3437
3438public:
3440 bool isvolatile, unsigned numoutputs, unsigned numinputs,
3442 Expr *asmstr, unsigned numclobbers, Expr **clobbers,
3444
3445
3447
3450
3451
3452
3456
3458
3459
3460
3461
3463 public:
3468
3469 private:
3470 Kind MyKind;
3471 std::string Str;
3472 unsigned OperandNo;
3473
3474
3476
3477 public:
3481 : MyKind(Operand), Str(S), OperandNo(OpNo),
3483
3486
3487 const std::string &getString() const { return Str; }
3488
3491 return OperandNo;
3492 }
3493
3495 assert(isOperand() && "Range is currently used only for Operands.");
3496 return Range;
3497 }
3498
3499
3500
3502 };
3503
3504
3505
3506
3507
3508
3510 const ASTContext &C, unsigned &DiagOffs) const;
3511
3512
3514
3515
3516
3518
3521 return II->getName();
3522
3523 return {};
3524 }
3525
3527
3529 return Constraints[i];
3530 }
3532
3534
3538
3539
3540
3544
3547 return II->getName();
3548
3549 return {};
3550 }
3551
3553
3560
3563
3567
3569
3570
3571
3573 return NumLabels > 0;
3574 }
3575
3577 return NumLabels;
3578 }
3579
3583
3590
3594
3598
3602
3606
3610
3614
3615private:
3616 void setOutputsAndInputsAndClobbers(const ASTContext &C,
3620 unsigned NumLabels, Expr **Clobbers,
3622
3623public:
3624
3625
3626
3627
3628
3630
3631 std::string getClobber(unsigned i) const;
3632
3635
3638
3640 return T->getStmtClass() == GCCAsmStmtClass;
3641 }
3642};
3643
3644
3647
3649 StringRef AsmStr;
3650
3651 unsigned NumAsmToks = 0;
3652
3653 Token *AsmToks = nullptr;
3654 StringRef *Constraints = nullptr;
3655 StringRef *Clobbers = nullptr;
3656
3657public:
3659 SourceLocation lbraceloc, bool issimple, bool isvolatile,
3660 ArrayRef asmtoks, unsigned numoutputs, unsigned numinputs,
3664
3665
3667
3672
3673 bool hasBraces() const { return LBraceLoc.isValid(); }
3674
3677
3678
3680
3681
3683
3684
3685
3688 return Constraints[i];
3689 }
3690
3692
3696
3697
3698
3703
3706
3710
3711
3712
3716
3718
3722
3724
3725private:
3729
3730public:
3732
3734 return T->getStmtClass() == MSAsmStmtClass;
3735 }
3736
3740
3744};
3745
3746class SEHExceptStmt : public Stmt {
3749
3751 Stmt *Children[2];
3752
3753 enum { FILTER_EXPR, BLOCK };
3754
3756 explicit SEHExceptStmt(EmptyShell E) : Stmt(SEHExceptStmtClass, E) {}
3757
3758public:
3760 SourceLocation ExceptLoc,
3761 Expr *FilterExpr,
3762 Stmt *Block);
3763
3765
3768
3770 return reinterpret_cast<Expr*>(Children[FILTER_EXPR]);
3771 }
3772
3776
3780
3784
3786 return T->getStmtClass() == SEHExceptStmtClass;
3787 }
3788};
3789
3790class SEHFinallyStmt : public Stmt {
3793
3795 Stmt *Block;
3796
3798 explicit SEHFinallyStmt(EmptyShell E) : Stmt(SEHFinallyStmtClass, E) {}
3799
3800public:
3804
3806
3809
3811
3815
3819
3821 return T->getStmtClass() == SEHFinallyStmtClass;
3822 }
3823};
3824
3825class SEHTryStmt : public Stmt {
3828
3829 bool IsCXXTry;
3831 Stmt *Children[2];
3832
3833 enum { TRY = 0, HANDLER = 1 };
3834
3835 SEHTryStmt(bool isCXXTry,
3837 Stmt *TryBlock,
3838 Stmt *Handler);
3839
3840 explicit SEHTryStmt(EmptyShell E) : Stmt(SEHTryStmtClass, E) {}
3841
3842public:
3844 SourceLocation TryLoc, Stmt *TryBlock,
3845 Stmt *Handler);
3846
3848
3851
3853
3857
3859
3860
3863
3867
3871
3873 return T->getStmtClass() == SEHTryStmtClass;
3874 }
3875};
3876
3877
3880
3881public:
3883 : Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}
3884
3885
3887
3890
3893
3895 return T->getStmtClass() == SEHLeaveStmtClass;
3896 }
3897
3898
3902
3906};
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917class CapturedStmt : public Stmt {
3918public:
3919
3920
3927
3928
3929
3930 class Capture {
3931 llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
3933
3935
3936 public:
3939
3940
3941
3942
3943
3944
3945
3946
3948 VarDecl *Var = nullptr);
3949
3950
3952
3953
3954
3956
3957
3959
3960
3962
3963
3967
3968
3969
3973
3974
3975
3976
3978 };
3979
3980private:
3981
3982 unsigned NumCaptures;
3983
3984
3985
3986 llvm::PointerIntPair<CapturedDecl *, 2, CapturedRegionKind> CapDeclAndKind;
3987
3988
3989 RecordDecl *TheRecordDecl = nullptr;
3990
3991
3994
3995
3997
3998 Stmt **getStoredStmts() { return reinterpret_cast<Stmt **>(this + 1); }
3999
4000 Stmt *const *getStoredStmts() const {
4001 return reinterpret_cast<Stmt *const *>(this + 1);
4002 }
4003
4004 Capture *getStoredCaptures() const;
4005
4006 void setCapturedStmt(Stmt *S) { getStoredStmts()[NumCaptures] = S; }
4007
4008public:
4010
4016
4018 unsigned NumCaptures);
4019
4020
4023
4024
4027
4028
4030
4031
4033
4034
4036
4037
4039
4040
4042 assert(D && "null RecordDecl");
4043 TheRecordDecl = D;
4044 }
4045
4046
4048
4049
4054
4061
4062
4065
4066
4067
4069 return getStoredCaptures() + NumCaptures;
4070 }
4071
4072
4074
4075
4078
4079
4080
4083 llvm::iterator_range<const_capture_init_iterator>;
4084
4088
4092
4093
4095 return reinterpret_cast<Expr **>(getStoredStmts());
4096 }
4097
4099 return reinterpret_cast<Expr *const *>(getStoredStmts());
4100 }
4101
4102
4103
4107
4111
4115
4119
4123
4125 return T->getStmtClass() == CapturedStmtClass;
4126 }
4127
4129
4131};
4132
4133}
4134
4135#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:3285
void setSimple(bool V)
Definition Stmt.h:3301
outputs_iterator begin_outputs()
Definition Stmt.h:3392
void setAsmLoc(SourceLocation L)
Definition Stmt.h:3298
const_outputs_iterator end_outputs() const
Definition Stmt.h:3408
std::string getInputConstraint(unsigned i) const
getInputConstraint - Return the specified input constraint.
SourceLocation AsmLoc
Definition Stmt.h:3271
bool isVolatile() const
Definition Stmt.h:3303
outputs_iterator end_outputs()
Definition Stmt.h:3396
const_inputs_iterator begin_inputs() const
Definition Stmt.h:3373
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:3287
void setVolatile(bool V)
Definition Stmt.h:3304
static bool classof(const Stmt *T)
Definition Stmt.h:3351
outputs_range outputs()
Definition Stmt.h:3400
inputs_const_range inputs() const
Definition Stmt.h:3381
SourceLocation getAsmLoc() const
Definition Stmt.h:3297
const Expr * getInputExpr(unsigned i) const
unsigned NumInputs
Definition Stmt.h:3282
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:3307
inputs_range inputs()
Definition Stmt.h:3371
llvm::iterator_range< inputs_iterator > inputs_range
Definition Stmt.h:3360
bool isOutputPlusConstraint(unsigned i) const
isOutputPlusConstraint - Return true if the specified output constraint is a "+" constraint (which is...
Definition Stmt.h:3326
unsigned getNumClobbers() const
Definition Stmt.h:3348
ExprIterator outputs_iterator
Definition Stmt.h:3387
const_inputs_iterator end_inputs() const
Definition Stmt.h:3377
llvm::iterator_range< const_inputs_iterator > inputs_const_range
Definition Stmt.h:3361
const_child_range children() const
Definition Stmt.h:3420
ExprIterator inputs_iterator
Definition Stmt.h:3358
bool IsSimple
True if the assembly statement does not have any input or output operands.
Definition Stmt.h:3275
const Expr * getOutputExpr(unsigned i) const
outputs_const_range outputs() const
Definition Stmt.h:3412
inputs_iterator end_inputs()
Definition Stmt.h:3367
unsigned getNumOutputs() const
Definition Stmt.h:3316
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:3306
inputs_iterator begin_inputs()
Definition Stmt.h:3363
AsmStmt(StmtClass SC, EmptyShell Empty)
Build an empty inline-assembly statement.
Definition Stmt.h:3295
unsigned NumOutputs
Definition Stmt.h:3281
child_range children()
Definition Stmt.h:3416
ConstExprIterator const_outputs_iterator
Definition Stmt.h:3388
ConstExprIterator const_inputs_iterator
Definition Stmt.h:3359
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
unsigned NumClobbers
Definition Stmt.h:3283
bool IsVolatile
If true, treat this inline assembly as having side effects.
Definition Stmt.h:3279
friend class ASTStmtReader
Definition Stmt.h:3269
unsigned getNumInputs() const
Definition Stmt.h:3338
bool isSimple() const
Definition Stmt.h:3300
llvm::iterator_range< outputs_iterator > outputs_range
Definition Stmt.h:3389
const_outputs_iterator begin_outputs() const
Definition Stmt.h:3404
std::string getClobber(unsigned i) const
llvm::iterator_range< const_outputs_iterator > outputs_const_range
Definition Stmt.h:3390
Attr - This represents one attribute.
Represents an attribute applied to a statement.
Definition Stmt.h:2193
static AttributedStmt * CreateEmpty(const ASTContext &C, unsigned NumAttrs)
Stmt * getSubStmt()
Definition Stmt.h:2229
const Stmt * getSubStmt() const
Definition Stmt.h:2230
SourceLocation getAttrLoc() const
Definition Stmt.h:2224
ArrayRef< const Attr * > getAttrs() const
Definition Stmt.h:2225
child_range children()
Definition Stmt.h:2235
const_child_range children() const
Definition Stmt.h:2237
friend class ASTStmtReader
Definition Stmt.h:2194
static bool classof(const Stmt *T)
Definition Stmt.h:2241
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2233
SourceLocation getBeginLoc() const
Definition Stmt.h:2232
BreakStmt(SourceLocation BL)
Definition Stmt.h:3127
static bool classof(const Stmt *T)
Definition Stmt.h:3135
BreakStmt(EmptyShell Empty)
Build an empty break statement.
Definition Stmt.h:3132
BreakStmt(SourceLocation CL, SourceLocation LabelLoc, LabelDecl *Target)
Definition Stmt.h:3128
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:3930
bool capturesVariableByCopy() const
Determine whether this capture handles a variable by copy.
Definition Stmt.h:3964
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:3970
friend class CapturedStmt
Definition Stmt.h:3938
bool capturesThis() const
Determine whether this capture handles the C++ 'this' pointer.
Definition Stmt.h:3958
bool capturesVariable() const
Determine whether this capture handles a variable (by reference).
Definition Stmt.h:3961
SourceLocation getLocation() const
Retrieve the source location at which the variable or 'this' was first used.
Definition Stmt.h:3955
friend class ASTStmtReader
Definition Stmt.h:3937
This captures a statement into a function.
Definition Stmt.h:3917
unsigned capture_size() const
Retrieve the number of captures, including 'this'.
Definition Stmt.h:4073
const_capture_iterator capture_begin() const
Definition Stmt.h:4064
static CapturedStmt * CreateDeserialized(const ASTContext &Context, unsigned NumCaptures)
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:4116
capture_init_range capture_inits()
Definition Stmt.h:4085
Expr ** capture_init_iterator
Iterator that walks over the capture initialization arguments.
Definition Stmt.h:4076
void setCapturedRegionKind(CapturedRegionKind Kind)
Set the captured region kind.
const_capture_init_iterator capture_init_begin() const
Definition Stmt.h:4098
const Capture * const_capture_iterator
Definition Stmt.h:4051
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
SourceRange getSourceRange() const LLVM_READONLY
Definition Stmt.h:4120
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of captures.
Definition Stmt.h:4068
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
Definition Stmt.h:4038
llvm::iterator_range< const_capture_init_iterator > const_capture_init_range
Definition Stmt.h:4082
Stmt * getCapturedStmt()
Retrieve the statement being captured.
Definition Stmt.h:4021
llvm::iterator_range< capture_init_iterator > capture_init_range
Definition Stmt.h:4077
Capture * capture_iterator
An iterator that walks over the captures.
Definition Stmt.h:4050
llvm::iterator_range< capture_iterator > capture_range
Definition Stmt.h:4052
bool capturesVariable(const VarDecl *Var) const
True if this variable has been captured.
static bool classof(const Stmt *T)
Definition Stmt.h:4124
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument.
Definition Stmt.h:4094
void setCapturedDecl(CapturedDecl *D)
Set the outlined function declaration.
capture_iterator capture_begin()
Retrieve an iterator pointing to the first capture.
Definition Stmt.h:4063
const_capture_init_iterator capture_init_end() const
Definition Stmt.h:4108
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:4112
void setCapturedRecordDecl(RecordDecl *D)
Set the record declaration for captured variables.
Definition Stmt.h:4041
friend class ASTStmtReader
Definition Stmt.h:4009
llvm::iterator_range< const_capture_iterator > capture_const_range
Definition Stmt.h:4053
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument.
Definition Stmt.h:4104
capture_range captures()
Definition Stmt.h:4055
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
Definition Stmt.h:4081
const Stmt * getCapturedStmt() const
Definition Stmt.h:4022
capture_const_range captures() const
Definition Stmt.h:4058
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:3921
@ VCK_ByCopy
Definition Stmt.h:3924
@ VCK_ByRef
Definition Stmt.h:3923
@ VCK_This
Definition Stmt.h:3922
@ VCK_VLAType
Definition Stmt.h:3925
const_capture_init_range capture_inits() const
Definition Stmt.h:4089
Stmt * getSubStmt()
Definition Stmt.h:2023
const Expr * getRHS() const
Definition Stmt.h:2011
Expr * getLHS()
Definition Stmt.h:1993
const_child_range children() const
Definition Stmt.h:2053
SourceLocation getBeginLoc() const
Definition Stmt.h:2032
void setEllipsisLoc(SourceLocation L)
Set the location of the ... in a case statement of the form LHS ... RHS.
Definition Stmt.h:1986
static bool classof(const Stmt *T)
Definition Stmt.h:2042
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ... RHS, which is a GNU extension.
Definition Stmt.h:1973
const Expr * getLHS() const
Definition Stmt.h:1997
SourceLocation getEllipsisLoc() const
Get the location of the ... in a case statement of the form LHS ... RHS.
Definition Stmt.h:1979
void setCaseLoc(SourceLocation L)
Definition Stmt.h:1976
child_range children()
Definition Stmt.h:2047
SourceLocation getCaseLoc() const
Definition Stmt.h:1975
static CaseStmt * CreateEmpty(const ASTContext &Ctx, bool CaseStmtIsGNURange)
Build an empty case statement.
void setLHS(Expr *Val)
Definition Stmt.h:2001
void setSubStmt(Stmt *S)
Definition Stmt.h:2028
const Stmt * getSubStmt() const
Definition Stmt.h:2024
Expr * getRHS()
Definition Stmt.h:2005
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2033
void setRHS(Expr *Val)
Definition Stmt.h:2017
Represents a character-granular source range.
CompoundStmt - This represents a group of statements like { stmt stmt }.
Definition Stmt.h:1730
Stmt * body_front()
Definition Stmt.h:1796
static bool classof(const Stmt *T)
Definition Stmt.h:1850
bool body_empty() const
Definition Stmt.h:1774
unsigned size() const
Definition Stmt.h:1775
body_const_range body() const
Definition Stmt.h:1805
Stmt *const * const_body_iterator
Definition Stmt.h:1802
const_reverse_body_iterator body_rend() const
Definition Stmt.h:1840
llvm::iterator_range< const_body_iterator > body_const_range
Definition Stmt.h:1803
std::reverse_iterator< body_iterator > reverse_body_iterator
Definition Stmt.h:1823
reverse_body_iterator body_rbegin()
Definition Stmt.h:1825
llvm::iterator_range< body_iterator > body_range
Definition Stmt.h:1791
std::reverse_iterator< const_body_iterator > const_reverse_body_iterator
Definition Stmt.h:1833
body_iterator body_end()
Definition Stmt.h:1795
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
Definition Stmt.h:1780
const Stmt * body_front() const
Definition Stmt.h:1815
body_range body()
Definition Stmt.h:1793
SourceLocation getBeginLoc() const
Definition Stmt.h:1844
static CompoundStmt * CreateEmpty(const ASTContext &C, unsigned NumStmts, bool HasFPFeatures)
SourceLocation getLBracLoc() const
Definition Stmt.h:1847
body_iterator body_begin()
Definition Stmt.h:1794
SourceLocation getEndLoc() const
Definition Stmt.h:1845
bool hasStoredFPFeatures() const
Definition Stmt.h:1777
const_child_range children() const
Definition Stmt.h:1857
CompoundStmt(SourceLocation Loc, SourceLocation EndLoc)
Definition Stmt.h:1764
reverse_body_iterator body_rend()
Definition Stmt.h:1829
CompoundStmt(SourceLocation Loc)
Definition Stmt.h:1762
const_body_iterator body_begin() const
Definition Stmt.h:1809
Stmt ** body_iterator
Definition Stmt.h:1790
const Stmt * body_back() const
Definition Stmt.h:1819
friend class ASTStmtReader
Definition Stmt.h:1731
const_reverse_body_iterator body_rbegin() const
Definition Stmt.h:1836
child_range children()
Definition Stmt.h:1855
Stmt * body_back()
Definition Stmt.h:1798
FPOptionsOverride getStoredFPFeaturesOrDefault() const
Get the store FPOptionsOverride or default if not stored.
Definition Stmt.h:1786
SourceLocation getRBracLoc() const
Definition Stmt.h:1848
const_body_iterator body_end() const
Definition Stmt.h:1813
ContinueStmt(EmptyShell Empty)
Build an empty continue statement.
Definition Stmt.h:3116
ContinueStmt(SourceLocation CL)
Definition Stmt.h:3111
static bool classof(const Stmt *T)
Definition Stmt.h:3119
ContinueStmt(SourceLocation CL, SourceLocation LabelLoc, LabelDecl *Target)
Definition Stmt.h:3112
Decl *const * const_iterator
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
Definition Stmt.h:1621
std::reverse_iterator< decl_iterator > reverse_decl_iterator
Definition Stmt.h:1680
llvm::iterator_range< decl_iterator > decl_range
Definition Stmt.h:1666
child_range children()
Definition Stmt.h:1654
const_child_range children() const
Definition Stmt.h:1659
Decl * getSingleDecl()
Definition Stmt.h:1637
SourceLocation getEndLoc() const
Definition Stmt.h:1644
const DeclGroupRef getDeclGroup() const
Definition Stmt.h:1639
DeclStmt(EmptyShell Empty)
Build an empty declaration statement.
Definition Stmt.h:1630
bool isSingleDecl() const
isSingleDecl - This method returns true if this DeclStmt refers to a single Decl.
Definition Stmt.h:1634
decl_iterator decl_end()
Definition Stmt.h:1676
const_decl_iterator decl_begin() const
Definition Stmt.h:1677
void setStartLoc(SourceLocation L)
Definition Stmt.h:1643
DeclGroupRef::const_iterator const_decl_iterator
Definition Stmt.h:1665
static bool classof(const Stmt *T)
Definition Stmt.h:1649
void setEndLoc(SourceLocation L)
Definition Stmt.h:1645
decl_iterator decl_begin()
Definition Stmt.h:1675
decl_range decls()
Definition Stmt.h:1669
void setDeclGroup(DeclGroupRef DGR)
Definition Stmt.h:1641
const Decl * getSingleDecl() const
Definition Stmt.h:1636
decl_const_range decls() const
Definition Stmt.h:1671
const_decl_iterator decl_end() const
Definition Stmt.h:1678
DeclGroupRef::iterator decl_iterator
Definition Stmt.h:1664
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:1647
DeclGroupRef getDeclGroup()
Definition Stmt.h:1640
reverse_decl_iterator decl_rend()
Definition Stmt.h:1686
llvm::iterator_range< const_decl_iterator > decl_const_range
Definition Stmt.h:1667
reverse_decl_iterator decl_rbegin()
Definition Stmt.h:1682
DeclStmt(DeclGroupRef dg, SourceLocation startLoc, SourceLocation endLoc)
Definition Stmt.h:1626
Decl - This represents one declaration (or definition), e.g.
void setSubStmt(Stmt *S)
Definition Stmt.h:2073
const Stmt * getSubStmt() const
Definition Stmt.h:2072
child_range children()
Definition Stmt.h:2088
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2079
void setDefaultLoc(SourceLocation L)
Definition Stmt.h:2076
SourceLocation getDefaultLoc() const
Definition Stmt.h:2075
DefaultStmt(EmptyShell Empty)
Build an empty default statement.
Definition Stmt.h:2068
static bool classof(const Stmt *T)
Definition Stmt.h:2083
DefaultStmt(SourceLocation DL, SourceLocation CL, Stmt *substmt)
Definition Stmt.h:2064
const_child_range children() const
Definition Stmt.h:2090
SourceLocation getBeginLoc() const
Definition Stmt.h:2078
Stmt * getSubStmt()
Definition Stmt.h:2071
const Stmt * getBody() const
Definition Stmt.h:3246
SourceLocation getEndLoc() const
Definition Stmt.h:3253
void setBody(Stmt *S)
Definition Stmt.h:3247
SourceLocation getBeginLoc() const
Definition Stmt.h:3252
void setDeferLoc(SourceLocation DeferLoc)
Definition Stmt.h:3241
Stmt * getBody()
Definition Stmt.h:3245
const_child_range children() const
Definition Stmt.h:3257
SourceLocation getDeferLoc() const
Definition Stmt.h:3240
static bool classof(const Stmt *S)
Definition Stmt.h:3261
static DeferStmt * CreateEmpty(ASTContext &Context, EmptyShell Empty)
friend class ASTStmtReader
Definition Stmt.h:3227
child_range children()
Definition Stmt.h:3255
void setWhileLoc(SourceLocation L)
Definition Stmt.h:2854
SourceLocation getBeginLoc() const
Definition Stmt.h:2858
Stmt * getBody()
Definition Stmt.h:2847
Expr * getCond()
Definition Stmt.h:2840
void setDoLoc(SourceLocation L)
Definition Stmt.h:2852
SourceLocation getEndLoc() const
Definition Stmt.h:2859
SourceLocation getWhileLoc() const
Definition Stmt.h:2853
static bool classof(const Stmt *T)
Definition Stmt.h:2861
const_child_range children() const
Definition Stmt.h:2870
DoStmt(EmptyShell Empty)
Build an empty do-while statement.
Definition Stmt.h:2838
SourceLocation getDoLoc() const
Definition Stmt.h:2851
void setRParenLoc(SourceLocation L)
Definition Stmt.h:2856
SourceLocation getRParenLoc() const
Definition Stmt.h:2855
const Stmt * getBody() const
Definition Stmt.h:2848
child_range children()
Definition Stmt.h:2866
void setBody(Stmt *Body)
Definition Stmt.h:2849
DoStmt(Stmt *Body, Expr *Cond, SourceLocation DL, SourceLocation WL, SourceLocation RP)
Definition Stmt.h:2829
const Expr * getCond() const
Definition Stmt.h:2841
void setCond(Expr *Cond)
Definition Stmt.h:2845
This represents one expression.
Represents difference between two FPOptions values.
Stmt * getInit()
Definition Stmt.h:2893
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:2949
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "for" statement, if any.
SourceLocation getEndLoc() const
Definition Stmt.h:2942
void setBody(Stmt *S)
Definition Stmt.h:2932
SourceLocation getRParenLoc() const
Definition Stmt.h:2938
const_child_range children() const
Definition Stmt.h:2953
void setCond(Expr *E)
Definition Stmt.h:2930
const DeclStmt * getConditionVariableDeclStmt() const
Definition Stmt.h:2912
void setForLoc(SourceLocation L)
Definition Stmt.h:2935
Stmt * getBody()
Definition Stmt.h:2922
const Expr * getInc() const
Definition Stmt.h:2926
ForStmt(EmptyShell Empty)
Build an empty for statement.
Definition Stmt.h:2891
void setInc(Expr *E)
Definition Stmt.h:2931
void setLParenLoc(SourceLocation L)
Definition Stmt.h:2937
Expr * getInc()
Definition Stmt.h:2921
const Expr * getCond() const
Definition Stmt.h:2925
void setInit(Stmt *S)
Definition Stmt.h:2929
void setConditionVariableDeclStmt(DeclStmt *CondVar)
Definition Stmt.h:2916
SourceLocation getBeginLoc() const
Definition Stmt.h:2941
static bool classof(const Stmt *T)
Definition Stmt.h:2944
const Stmt * getInit() const
Definition Stmt.h:2924
void setConditionVariable(const ASTContext &C, VarDecl *V)
SourceLocation getForLoc() const
Definition Stmt.h:2934
friend class ASTStmtReader
Definition Stmt.h:2879
const Stmt * getBody() const
Definition Stmt.h:2927
Expr * getCond()
Definition Stmt.h:2920
SourceLocation getLParenLoc() const
Definition Stmt.h:2936
DeclStmt * getConditionVariableDeclStmt()
If this ForStmt has a condition variable, return the faux DeclStmt associated with the creation of th...
Definition Stmt.h:2908
void setRParenLoc(SourceLocation L)
Definition Stmt.h:2939
bool isString() const
Definition Stmt.h:3484
bool isOperand() const
Definition Stmt.h:3485
AsmStringPiece(const std::string &S)
Definition Stmt.h:3478
const std::string & getString() const
Definition Stmt.h:3487
unsigned getOperandNo() const
Definition Stmt.h:3489
Kind
Definition Stmt.h:3464
@ Operand
Definition Stmt.h:3466
@ String
Definition Stmt.h:3465
CharSourceRange getRange() const
Definition Stmt.h:3494
AsmStringPiece(unsigned OpNo, const std::string &S, SourceLocation Begin, SourceLocation End)
Definition Stmt.h:3479
char getModifier() const
getModifier - Get the modifier for this operand, if present.
const Expr * getInputExpr(unsigned i) const
Definition Stmt.h:3564
const_labels_iterator end_labels() const
Definition Stmt.h:3607
std::string getOutputConstraint(unsigned i) const
getOutputConstraint - Return the constraint string for the specified output operand.
unsigned getNumLabels() const
Definition Stmt.h:3576
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
labels_range labels()
Definition Stmt.h:3599
SourceLocation getRParenLoc() const
Definition Stmt.h:3448
std::string getAsmString() const
labels_const_range labels() const
Definition Stmt.h:3611
llvm::iterator_range< labels_iterator > labels_range
Definition Stmt.h:3588
Expr * getInputConstraintExpr(unsigned i)
Definition Stmt.h:3557
void setAsmStringExpr(Expr *E)
Definition Stmt.h:3455
labels_iterator begin_labels()
Definition Stmt.h:3591
IdentifierInfo * getInputIdentifier(unsigned i) const
Definition Stmt.h:3541
bool isAsmGoto() const
Definition Stmt.h:3572
ConstCastIterator< AddrLabelExpr > const_labels_iterator
Definition Stmt.h:3587
CastIterator< AddrLabelExpr > labels_iterator
Definition Stmt.h:3586
const Expr * getClobberExpr(unsigned i) const
Definition Stmt.h:3634
std::string getInputConstraint(unsigned i) const
getInputConstraint - Return the specified input constraint.
labels_iterator end_labels()
Definition Stmt.h:3595
const Expr * getOutputConstraintExpr(unsigned i) const
Definition Stmt.h:3528
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:3449
void setInputExpr(unsigned i, Expr *E)
Expr * getAsmStringExpr()
Definition Stmt.h:3454
std::string getClobber(unsigned i) const
static bool classof(const Stmt *T)
Definition Stmt.h:3639
StringRef getInputName(unsigned i) const
Definition Stmt.h:3545
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:3637
StringRef getOutputName(unsigned i) const
Definition Stmt.h:3519
const_labels_iterator begin_labels() const
Definition Stmt.h:3603
GCCAsmStmt(EmptyShell Empty)
Build an empty inline-assembly statement.
Definition Stmt.h:3446
IdentifierInfo * getLabelIdentifier(unsigned i) const
Definition Stmt.h:3580
const Expr * getInputConstraintExpr(unsigned i) const
Definition Stmt.h:3554
IdentifierInfo * getOutputIdentifier(unsigned i) const
Definition Stmt.h:3517
const Expr * getAsmStringExpr() const
Definition Stmt.h:3453
Expr * getOutputExpr(unsigned i)
llvm::iterator_range< const_labels_iterator > labels_const_range
Definition Stmt.h:3589
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:3531
Expr * getClobberExpr(unsigned i)
Definition Stmt.h:3633
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:3427
const Expr * getOutputExpr(unsigned i) const
Definition Stmt.h:3535
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:3636
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:2964
SourceLocation getLabelLoc() const
Definition Stmt.h:2977
SourceLocation getGotoLoc() const
Definition Stmt.h:2975
child_range children()
Definition Stmt.h:2988
void setLabel(LabelDecl *D)
Definition Stmt.h:2973
GotoStmt(EmptyShell Empty)
Build an empty goto statement.
Definition Stmt.h:2970
void setLabelLoc(SourceLocation L)
Definition Stmt.h:2978
LabelDecl * getLabel() const
Definition Stmt.h:2972
SourceLocation getEndLoc() const
Definition Stmt.h:2981
const_child_range children() const
Definition Stmt.h:2992
static bool classof(const Stmt *T)
Definition Stmt.h:2983
void setGotoLoc(SourceLocation L)
Definition Stmt.h:2976
SourceLocation getBeginLoc() const
Definition Stmt.h:2980
One of these records is kept for each identifier that is lexed.
Stmt * getThen()
Definition Stmt.h:2338
bool hasElseStorage() const
True if this IfStmt has storage for an else statement.
Definition Stmt.h:2324
const Stmt * getElse() const
Definition Stmt.h:2352
void setThen(Stmt *Then)
Definition Stmt.h:2343
void setConditionVariableDeclStmt(DeclStmt *CondVar)
Definition Stmt.h:2394
void setCond(Expr *Cond)
Definition Stmt.h:2334
void setLParenLoc(SourceLocation Loc)
Definition Stmt.h:2468
SourceLocation getIfLoc() const
Definition Stmt.h:2415
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:2321
const DeclStmt * getConditionVariableDeclStmt() const
Definition Stmt.h:2388
IfStatementKind getStatementKind() const
Definition Stmt.h:2450
SourceLocation getElseLoc() const
Definition Stmt.h:2418
Stmt * getInit()
Definition Stmt.h:2399
bool isNonNegatedConsteval() const
Definition Stmt.h:2434
SourceLocation getLParenLoc() const
Definition Stmt.h:2467
static bool classof(const Stmt *T)
Definition Stmt.h:2492
void setElse(Stmt *Else)
Definition Stmt.h:2357
Expr * getCond()
Definition Stmt.h:2326
const Stmt * getThen() const
Definition Stmt.h:2339
bool isConstexpr() const
Definition Stmt.h:2442
const Expr * getCond() const
Definition Stmt.h:2330
const VarDecl * getConditionVariable() const
Definition Stmt.h:2372
void setElseLoc(SourceLocation ElseLoc)
Definition Stmt.h:2423
const Stmt * getInit() const
Definition Stmt.h:2404
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:2318
void setStatementKind(IfStatementKind Kind)
Definition Stmt.h:2446
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:2474
bool isNegatedConsteval() const
Definition Stmt.h:2438
Stmt * getElse()
Definition Stmt.h:2347
DeclStmt * getConditionVariableDeclStmt()
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
Definition Stmt.h:2382
const_child_range children() const
Definition Stmt.h:2483
SourceLocation getRParenLoc() const
Definition Stmt.h:2469
void setRParenLoc(SourceLocation Loc)
Definition Stmt.h:2470
SourceLocation getBeginLoc() const
Definition Stmt.h:2461
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2462
bool isConsteval() const
Definition Stmt.h:2429
void setIfLoc(SourceLocation IfLoc)
Definition Stmt.h:2416
VarDecl * getConditionVariable()
Retrieve the variable declared in this "if" statement, if any.
void setInit(Stmt *Init)
Definition Stmt.h:2409
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:3032
static bool classof(const Stmt *T)
Definition Stmt.h:3034
LabelDecl * getConstantTarget()
getConstantTarget - Returns the fixed target of this indirect goto, if one exists.
IndirectGotoStmt(SourceLocation gotoLoc, SourceLocation starLoc, Expr *target)
Definition Stmt.h:3003
void setTarget(Expr *E)
Definition Stmt.h:3022
SourceLocation getGotoLoc() const
Definition Stmt.h:3014
SourceLocation getBeginLoc() const
Definition Stmt.h:3031
child_range children()
Definition Stmt.h:3039
void setGotoLoc(SourceLocation L)
Definition Stmt.h:3013
Expr * getTarget()
Definition Stmt.h:3018
const_child_range children() const
Definition Stmt.h:3041
const LabelDecl * getConstantTarget() const
Definition Stmt.h:3027
void setStarLoc(SourceLocation L)
Definition Stmt.h:3015
IndirectGotoStmt(EmptyShell Empty)
Build an empty indirect goto statement.
Definition Stmt.h:3010
const Expr * getTarget() const
Definition Stmt.h:3019
SourceLocation getStarLoc() const
Definition Stmt.h:3016
Represents the declaration of a label.
Stmt * getInnermostLabeledStmt()
Definition Stmt.h:2169
LabelStmt(SourceLocation IL, LabelDecl *D, Stmt *substmt)
Build a label statement.
Definition Stmt.h:2143
static bool classof(const Stmt *T)
Definition Stmt.h:2180
LabelDecl * getDecl() const
Definition Stmt.h:2154
LabelStmt(EmptyShell Empty)
Build an empty label statement.
Definition Stmt.h:2149
bool isSideEntry() const
Definition Stmt.h:2183
Stmt * getSubStmt()
Definition Stmt.h:2158
SourceLocation getIdentLoc() const
Definition Stmt.h:2151
void setSubStmt(Stmt *SS)
Definition Stmt.h:2161
void setDecl(LabelDecl *D)
Definition Stmt.h:2155
SourceLocation getBeginLoc() const
Definition Stmt.h:2163
void setIdentLoc(SourceLocation L)
Definition Stmt.h:2152
const_child_range children() const
Definition Stmt.h:2176
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:2164
child_range children()
Definition Stmt.h:2174
void setSideEntry(bool SE)
Definition Stmt.h:2184
const char * getName() const
const Stmt * getSubStmt() const
Definition Stmt.h:2160
SourceLocation getBeginLoc() const
Definition Stmt.h:3075
LoopControlStmt(StmtClass Class, SourceLocation Loc)
Definition Stmt.h:3066
LoopControlStmt(StmtClass Class, EmptyShell ES)
Definition Stmt.h:3069
void setLabelDecl(LabelDecl *S)
Definition Stmt.h:3087
LoopControlStmt(StmtClass Class, SourceLocation Loc, SourceLocation LabelLoc, LabelDecl *Target)
Definition Stmt.h:3060
static bool classof(const Stmt *T)
Definition Stmt.h:3102
SourceLocation getLabelLoc() const
Definition Stmt.h:3082
LabelDecl * getLabelDecl()
Definition Stmt.h:3085
const LabelDecl * getLabelDecl() const
Definition Stmt.h:3086
void setLabelLoc(SourceLocation L)
Definition Stmt.h:3083
const_child_range children() const
Definition Stmt.h:3098
SourceLocation getKwLoc() const
Definition Stmt.h:3072
child_range children()
Definition Stmt.h:3094
void setKwLoc(SourceLocation L)
Definition Stmt.h:3073
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:3080
SourceLocation getEndLoc() const
Definition Stmt.h:3076
Token * getAsmToks()
Definition Stmt.h:3676
const Expr * getOutputExpr(unsigned i) const
Definition Stmt.h:3693
Expr * getOutputExpr(unsigned i)
ArrayRef< StringRef > getClobbers() const
Definition Stmt.h:3717
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:3731
StringRef getAsmString() const
Definition Stmt.h:3679
child_range children()
Definition Stmt.h:3737
SourceLocation getLBraceLoc() const
Definition Stmt.h:3668
bool hasBraces() const
Definition Stmt.h:3673
SourceLocation getEndLoc() const
Definition Stmt.h:3670
StringRef getInputConstraint(unsigned i) const
Definition Stmt.h:3699
void setEndLoc(SourceLocation L)
Definition Stmt.h:3671
void setInputExpr(unsigned i, Expr *E)
StringRef getOutputConstraint(unsigned i) const
Definition Stmt.h:3686
ArrayRef< StringRef > getAllConstraints() const
Definition Stmt.h:3713
static bool classof(const Stmt *T)
Definition Stmt.h:3733
friend class ASTStmtReader
Definition Stmt.h:3646
StringRef getClobber(unsigned i) const
Definition Stmt.h:3723
const Expr * getInputExpr(unsigned i) const
Definition Stmt.h:3707
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:3675
void setLBraceLoc(SourceLocation L)
Definition Stmt.h:3669
MSAsmStmt(EmptyShell Empty)
Build an empty MS-style inline-assembly statement.
Definition Stmt.h:3666
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
const_child_range children() const
Definition Stmt.h:3741
ArrayRef< Expr * > getAllExprs() const
Definition Stmt.h:3719
Expr * getInputExpr(unsigned i)
void setSemiLoc(SourceLocation L)
Definition Stmt.h:1705
bool hasLeadingEmptyMacro() const
Definition Stmt.h:1707
SourceLocation getBeginLoc() const
Definition Stmt.h:1711
child_range children()
Definition Stmt.h:1718
SourceLocation getSemiLoc() const
Definition Stmt.h:1704
static bool classof(const Stmt *T)
Definition Stmt.h:1714
NullStmt(SourceLocation L, bool hasLeadingEmptyMacro=false)
Definition Stmt.h:1695
NullStmt(EmptyShell Empty)
Build an empty null statement.
Definition Stmt.h:1702
const_child_range children() const
Definition Stmt.h:1722
SourceLocation getEndLoc() const
Definition Stmt.h:1712
Represents a struct/union/class.
void setRetValue(Expr *E)
Definition Stmt.h:3179
void setReturnLoc(SourceLocation L)
Definition Stmt.h:3200
SourceLocation getReturnLoc() const
Definition Stmt.h:3199
static bool classof(const Stmt *T)
Definition Stmt.h:3207
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:3203
void setNRVOCandidate(const VarDecl *Var)
Set the variable that might be used for the named return value optimization.
Definition Stmt.h:3193
SourceLocation getBeginLoc() const
Definition Stmt.h:3202
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization.
Definition Stmt.h:3186
const_child_range children() const
Definition Stmt.h:3218
Expr * getRetValue()
Definition Stmt.h:3177
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:3212
const Expr * getRetValue() const
Definition Stmt.h:3178
const_child_range children() const
Definition Stmt.h:3781
child_range children()
Definition Stmt.h:3777
CompoundStmt * getBlock() const
Definition Stmt.h:3773
friend class ASTReader
Definition Stmt.h:3747
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:3764
SourceLocation getExceptLoc() const
Definition Stmt.h:3766
friend class ASTStmtReader
Definition Stmt.h:3748
SourceLocation getEndLoc() const
Definition Stmt.h:3767
static bool classof(const Stmt *T)
Definition Stmt.h:3785
Expr * getFilterExpr() const
Definition Stmt.h:3769
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:3805
SourceLocation getEndLoc() const
Definition Stmt.h:3808
const_child_range children() const
Definition Stmt.h:3816
child_range children()
Definition Stmt.h:3812
friend class ASTReader
Definition Stmt.h:3791
SourceLocation getFinallyLoc() const
Definition Stmt.h:3807
static bool classof(const Stmt *T)
Definition Stmt.h:3820
friend class ASTStmtReader
Definition Stmt.h:3792
CompoundStmt * getBlock() const
Definition Stmt.h:3810
SourceLocation getLeaveLoc() const
Definition Stmt.h:3888
child_range children()
Definition Stmt.h:3899
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:3892
SEHLeaveStmt(EmptyShell Empty)
Build an empty __leave statement.
Definition Stmt.h:3886
SEHLeaveStmt(SourceLocation LL)
Definition Stmt.h:3882
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:3891
static bool classof(const Stmt *T)
Definition Stmt.h:3894
void setLeaveLoc(SourceLocation L)
Definition Stmt.h:3889
const_child_range children() const
Definition Stmt.h:3903
child_range children()
Definition Stmt.h:3864
const_child_range children() const
Definition Stmt.h:3868
CompoundStmt * getTryBlock() const
Definition Stmt.h:3854
static bool classof(const Stmt *T)
Definition Stmt.h:3872
SourceLocation getTryLoc() const
Definition Stmt.h:3849
bool getIsCXXTry() const
Definition Stmt.h:3852
SEHFinallyStmt * getFinallyHandler() const
friend class ASTReader
Definition Stmt.h:3826
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Stmt.h:3847
friend class ASTStmtReader
Definition Stmt.h:3827
SourceLocation getEndLoc() const
Definition Stmt.h:3850
SEHExceptStmt * getExceptHandler() const
Returns 0 if not defined.
Stmt * getHandler() const
Definition Stmt.h:3858
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 MatrixSubscriptExpr
Definition Stmt.h:542
friend class ArrayTypeTraitExpr
Definition Stmt.h:1209
friend class ASTStmtReader
Definition Stmt.h:1210
friend class ASTStmtReader
Definition Stmt.h:170
friend class AttributedStmt
Definition Stmt.h:171
friend class BinaryOperator
Definition Stmt.h:648
friend class CXXBoolLiteralExpr
Definition Stmt.h:800
friend class CXXConstructExpr
Definition Stmt.h:1015
friend class ASTStmtReader
Definition Stmt.h:1014
friend class CXXDefaultArgExpr
Definition Stmt.h:859
friend class ASTStmtReader
Definition Stmt.h:858
friend class ASTStmtReader
Definition Stmt.h:873
friend class CXXDefaultInitExpr
Definition Stmt.h:874
friend class CXXDeleteExpr
Definition Stmt.h:946
friend class ASTStmtReader
Definition Stmt.h:945
friend class CXXDependentScopeMemberExpr
Definition Stmt.h:1065
friend class ASTStmtReader
Definition Stmt.h:1064
friend class CXXFoldExpr
Definition Stmt.h:1235
friend class ASTStmtWriter
Definition Stmt.h:1237
friend class ASTStmtReader
Definition Stmt.h:1236
friend class ASTStmtWriter
Definition Stmt.h:900
friend class CXXNewExpr
Definition Stmt.h:901
friend class ASTStmtReader
Definition Stmt.h:899
friend class ASTStmtReader
Definition Stmt.h:1148
friend class CXXNoexceptExpr
Definition Stmt.h:1149
friend class CXXNullPtrLiteralExpr
Definition Stmt.h:814
friend class CXXOperatorCallExpr
Definition Stmt.h:777
friend class ASTStmtReader
Definition Stmt.h:776
friend class CXXRewrittenBinaryOperator
Definition Stmt.h:790
friend class ASTStmtReader
Definition Stmt.h:789
friend class CXXScalarValueInitExpr
Definition Stmt.h:890
friend class ASTStmtReader
Definition Stmt.h:889
friend class CXXThisExpr
Definition Stmt.h:824
friend class CXXThrowExpr
Definition Stmt.h:844
friend class ASTStmtReader
Definition Stmt.h:843
friend class CXXUnresolvedConstructExpr
Definition Stmt.h:1054
friend class ASTStmtReader
Definition Stmt.h:1053
friend class CallExpr
Definition Stmt.h:551
friend class ImplicitCastExpr
Definition Stmt.h:628
friend class CastExpr
Definition Stmt.h:627
friend class CharacterLiteral
Definition Stmt.h:499
friend class ChooseExpr
Definition Stmt.h:764
friend class ASTStmtReader
Definition Stmt.h:763
friend class CoawaitExpr
Definition Stmt.h:1262
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:1301
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:1002
friend class ASTStmtWriter
Definition Stmt.h:1001
friend class ASTStmtReader
Definition Stmt.h:1000
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:1040
friend class ASTStmtReader
Definition Stmt.h:1039
friend class ExpressionTraitExpr
Definition Stmt.h:1220
friend class ASTStmtReader
Definition Stmt.h:1221
friend class FloatingLiteral
Definition Stmt.h:459
friend class ForStmt
Definition Stmt.h:260
friend class GenericSelectionExpr
Definition Stmt.h:695
friend class ASTStmtReader
Definition Stmt.h:694
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:671
friend class LabelStmt
Definition Stmt.h:161
friend class LambdaExpr
Definition Stmt.h:1172
friend class ASTStmtWriter
Definition Stmt.h:1171
friend class ASTStmtReader
Definition Stmt.h:1170
friend class LoopControlStmt
Definition Stmt.h:281
friend class MemberExpr
Definition Stmt.h:585
friend class ASTStmtReader
Definition Stmt.h:584
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:1274
friend class OpaqueValueExpr
Definition Stmt.h:1287
friend class ASTStmtReader
Definition Stmt.h:1286
friend class ASTStmtReader
Definition Stmt.h:1090
friend class OverloadExpr
Definition Stmt.h:1091
friend class PackIndexingExpr
Definition Stmt.h:1246
friend class ASTStmtWriter
Definition Stmt.h:1247
friend class ASTStmtReader
Definition Stmt.h:1248
friend class ParenExpr
Definition Stmt.h:731
friend class ASTStmtWriter
Definition Stmt.h:730
friend class ASTStmtReader
Definition Stmt.h:729
friend class ParenListExpr
Definition Stmt.h:684
friend class ASTStmtReader
Definition Stmt.h:683
friend class PredefinedExpr
Definition Stmt.h:407
friend class ASTStmtReader
Definition Stmt.h:406
friend class PseudoObjectExpr
Definition Stmt.h:706
friend class ASTStmtReader
Definition Stmt.h:705
friend class RequiresExpr
Definition Stmt.h:1198
friend class ASTStmtWriter
Definition Stmt.h:1197
friend class ASTStmtReader
Definition Stmt.h:1196
friend class ReturnStmt
Definition Stmt.h:291
friend class ShuffleVectorExpr
Definition Stmt.h:741
friend class SourceLocExpr
Definition Stmt.h:717
friend class ASTStmtReader
Definition Stmt.h:716
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:751
friend class ASTStmtReader
Definition Stmt.h:750
friend class StringLiteral
Definition Stmt.h:475
friend class ASTStmtReader
Definition Stmt.h:474
friend class SubstNonTypeTemplateParmExpr
Definition Stmt.h:1160
friend class ASTStmtReader
Definition Stmt.h:1159
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:977
friend class ASTStmtWriter
Definition Stmt.h:976
friend class ASTStmtReader
Definition Stmt.h:975
friend class UnaryExprOrTypeTraitExpr
Definition Stmt.h:529
friend class UnaryOperator
Definition Stmt.h:509
friend class UnresolvedLookupExpr
Definition Stmt.h:1113
friend class ASTStmtReader
Definition Stmt.h:1112
friend class UnresolvedMemberExpr
Definition Stmt.h:1129
friend class ASTStmtReader
Definition Stmt.h:1128
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:1386
LoopControlStmtBitfields LoopControlStmtBits
Definition Stmt.h:1328
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:1342
CXXUnresolvedConstructExprBitfields CXXUnresolvedConstructExprBits
Definition Stmt.h:1376
WhileStmtBitfields WhileStmtBits
Definition Stmt.h:1324
SwitchCaseBitfields SwitchCaseBits
Definition Stmt.h:1330
GenericSelectionExprBitfields GenericSelectionExprBits
Definition Stmt.h:1350
InitListExprBitfields InitListExprBits
Definition Stmt.h:1348
static void EnableStatistics()
LambdaExprBitfields LambdaExprBits
Definition Stmt.h:1383
AttributedStmtBitfields AttributedStmtBits
Definition Stmt.h:1321
Stmt(StmtClass SC)
Definition Stmt.h:1474
ParenListExprBitfields ParenListExprBits
Definition Stmt.h:1349
ArrayOrMatrixSubscriptExprBitfields ArrayOrMatrixSubscriptExprBits
Definition Stmt.h:1343
UnresolvedLookupExprBitfields UnresolvedLookupExprBits
Definition Stmt.h:1379
SwitchStmtBitfields SwitchStmtBits
Definition Stmt.h:1323
SubstNonTypeTemplateParmExprBitfields SubstNonTypeTemplateParmExprBits
Definition Stmt.h:1382
CXXNoexceptExprBitfields CXXNoexceptExprBits
Definition Stmt.h:1381
ParenExprBitfields ParenExprBits
Definition Stmt.h:1353
StmtIterator child_iterator
Child Iterators: All subclasses must implement 'children' to permit easy iteration over the substatem...
Definition Stmt.h:1569
CXXRewrittenBinaryOperatorBitfields CXXRewrittenBinaryOperatorBits
Definition Stmt.h:1362
CallExprBitfields CallExprBits
Definition Stmt.h:1344
Stmt * stripLabelLikeStatements()
Definition Stmt.h:1561
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:1454
const Stmt * stripLabelLikeStatements() const
Strip off all label-like statements.
ShuffleVectorExprBitfields ShuffleVectorExprBits
Definition Stmt.h:1354
ExprWithCleanupsBitfields ExprWithCleanupsBits
Definition Stmt.h:1375
FloatingLiteralBitfields FloatingLiteralBits
Definition Stmt.h:1338
const_child_range children() const
Definition Stmt.h:1577
child_iterator child_begin()
Definition Stmt.h:1581
void printJson(raw_ostream &Out, PrinterHelper *Helper, const PrintingPolicy &Policy, bool AddQuotes) const
Pretty-prints in JSON format.
StmtClass getStmtClass() const
Definition Stmt.h:1483
CXXScalarValueInitExprBitfields CXXScalarValueInitExprBits
Definition Stmt.h:1369
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:1340
OverloadExprBitfields OverloadExprBits
Definition Stmt.h:1378
CXXConstructExprBitfields CXXConstructExprBits
Definition Stmt.h:1374
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:1341
static std::tuple< bool, const Attr *, const Attr * > determineLikelihoodConflict(const Stmt *Then, const Stmt *Else)
CXXDependentScopeMemberExprBitfields CXXDependentScopeMemberExprBits
Definition Stmt.h:1377
GotoStmtBitfields GotoStmtBits
Definition Stmt.h:1327
child_iterator child_end()
Definition Stmt.h:1582
ConstCastIterator< Expr > ConstExprIterator
Definition Stmt.h:1457
TypeTraitExprBitfields TypeTraitExprBits
Definition Stmt.h:1372
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:1370
SourceLocExprBitfields SourceLocExprBits
Definition Stmt.h:1352
CXXNullPtrLiteralExprBitfields CXXNullPtrLiteralExprBits
Definition Stmt.h:1364
CoawaitExprBitfields CoawaitBits
Definition Stmt.h:1391
Stmt(StmtClass SC, EmptyShell)
Construct an empty statement.
Definition Stmt.h:1465
ChooseExprBitfields ChooseExprBits
Definition Stmt.h:1358
ConstantExprBitfields ConstantExprBits
Definition Stmt.h:1335
llvm::iterator_range< child_iterator > child_range
Definition Stmt.h:1572
DeferStmtBitfields DeferStmtBits
Definition Stmt.h:1331
CompoundStmtBitfields CompoundStmtBits
Definition Stmt.h:1319
RequiresExprBitfields RequiresExprBits
Definition Stmt.h:1384
CXXFoldExprBitfields CXXFoldExprBits
Definition Stmt.h:1387
StmtExprBitfields StmtExprBits
Definition Stmt.h:1357
StringLiteralBitfields StringLiteralBits
Definition Stmt.h:1339
OpaqueValueExprBitfields OpaqueValueExprBits
Definition Stmt.h:1397
CastExprBitfields CastExprBits
Definition Stmt.h:1346
Likelihood
The likelihood of a branch being taken.
Definition Stmt.h:1426
@ LH_Unlikely
Branch has the [[unlikely]] attribute.
Definition Stmt.h:1427
@ LH_None
No attribute set or branches of the IfStmt have the same attribute.
Definition Stmt.h:1428
@ LH_Likely
Branch has the [[likely]] attribute.
Definition Stmt.h:1430
CXXThrowExprBitfields CXXThrowExprBits
Definition Stmt.h:1366
static void addStmtClass(const StmtClass s)
MemberExprBitfields MemberExprBits
Definition Stmt.h:1345
PackIndexingExprBitfields PackIndexingExprBits
Definition Stmt.h:1388
friend class ASTStmtWriter
Definition Stmt.h:101
ForStmtBitfields ForStmtBits
Definition Stmt.h:1326
@ NumOverloadExprBits
Definition Stmt.h:1109
DeclRefExprBitfields DeclRefExprBits
Definition Stmt.h:1337
const_child_iterator child_end() const
Definition Stmt.h:1585
const char * getStmtClassName() const
ConstStmtIterator const_child_iterator
Definition Stmt.h:1570
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:1363
CXXOperatorCallExprBitfields CXXOperatorCallExprBits
Definition Stmt.h:1361
CXXDefaultInitExprBitfields CXXDefaultInitExprBits
Definition Stmt.h:1368
Stmt & operator=(const Stmt &)=delete
NullStmtBitfields NullStmtBits
Definition Stmt.h:1318
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:1373
friend class ASTStmtReader
Definition Stmt.h:100
ArrayTypeTraitExprBitfields ArrayTypeTraitExprBits
Definition Stmt.h:1385
StmtBitfields StmtBits
Definition Stmt.h:1317
IfStmtBitfields IfStmtBits
Definition Stmt.h:1322
Stmt & operator=(Stmt &&)=delete
PredefinedExprBitfields PredefinedExprBits
Definition Stmt.h:1336
ConvertVectorExprBitfields ConvertVectorExprBits
Definition Stmt.h:1398
@ NumExprBits
Definition Stmt.h:366
int64_t getID(const ASTContext &Context) const
ReturnStmtBitfields ReturnStmtBits
Definition Stmt.h:1329
LabelStmtBitfields LabelStmtBits
Definition Stmt.h:1320
ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits
Definition Stmt.h:1394
SourceLocation getBeginLoc() const LLVM_READONLY
void dumpColor() const
dumpColor - same as dump(), but forces color highlighting.
BinaryOperatorBitfields BinaryOperatorBits
Definition Stmt.h:1347
UnresolvedMemberExprBitfields UnresolvedMemberExprBits
Definition Stmt.h:1380
PseudoObjectExprBitfields PseudoObjectExprBits
Definition Stmt.h:1351
ExprBitfields ExprBits
Definition Stmt.h:1334
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:1573
const_child_iterator child_begin() const
Definition Stmt.h:1584
CXXDeleteExprBitfields CXXDeleteExprBits
Definition Stmt.h:1371
CXXDefaultArgExprBitfields CXXDefaultArgExprBits
Definition Stmt.h:1367
DoStmtBitfields DoStmtBits
Definition Stmt.h:1325
@ NumCallExprBits
Definition Stmt.h:581
CXXThisExprBitfields CXXThisExprBits
Definition Stmt.h:1365
CastIterator< Expr > ExprIterator
Definition Stmt.h:1456
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:1873
void setColonLoc(SourceLocation L)
Definition Stmt.h:1890
static bool classof(const Stmt *T)
Definition Stmt.h:1900
SwitchCase(StmtClass SC, EmptyShell)
Definition Stmt.h:1880
SourceLocation getKeywordLoc() const
Definition Stmt.h:1887
Stmt * getSubStmt()
Definition Stmt.h:2103
SwitchCase(StmtClass SC, SourceLocation KWLoc, SourceLocation ColonLoc)
Definition Stmt.h:1875
void setKeywordLoc(SourceLocation L)
Definition Stmt.h:1888
const Stmt * getSubStmt() const
Definition Stmt.h:1893
void setNextSwitchCase(SwitchCase *SC)
Definition Stmt.h:1885
SourceLocation getColonLoc() const
Definition Stmt.h:1889
SourceLocation getBeginLoc() const
Definition Stmt.h:1897
const SwitchCase * getNextSwitchCase() const
Definition Stmt.h:1883
SourceLocation ColonLoc
The location of the ":".
Definition Stmt.h:1866
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2095
SwitchCase * getNextSwitchCase()
Definition Stmt.h:1884
void setCond(Expr *Cond)
Definition Stmt.h:2570
const Stmt * getInit() const
Definition Stmt.h:2583
SourceLocation getSwitchLoc() const
Definition Stmt.h:2634
void addSwitchCase(SwitchCase *SC)
Definition Stmt.h:2646
void setBody(Stmt *S, SourceLocation SL)
Definition Stmt.h:2641
SourceLocation getLParenLoc() const
Definition Stmt.h:2636
const Expr * getCond() const
Definition Stmt.h:2566
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:2659
void setSwitchLoc(SourceLocation L)
Definition Stmt.h:2635
void setConditionVariableDeclStmt(DeclStmt *CondVar)
Definition Stmt.h:2625
void setBody(Stmt *Body)
Definition Stmt.h:2577
void setRParenLoc(SourceLocation Loc)
Definition Stmt.h:2639
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2664
SourceLocation getRParenLoc() const
Definition Stmt.h:2638
void setInit(Stmt *Init)
Definition Stmt.h:2587
void setConditionVariable(const ASTContext &Ctx, VarDecl *VD)
Set the condition variable in this switch statement.
void setLParenLoc(SourceLocation Loc)
Definition Stmt.h:2637
child_range children()
Definition Stmt.h:2670
const Stmt * getBody() const
Definition Stmt.h:2575
const VarDecl * getConditionVariable() const
Definition Stmt.h:2603
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:2619
Expr * getCond()
Definition Stmt.h:2562
bool hasVarStorage() const
True if this SwitchStmt has storage for a condition variable.
Definition Stmt.h:2560
Stmt * getBody()
Definition Stmt.h:2574
const_child_range children() const
Definition Stmt.h:2675
VarDecl * getConditionVariable()
Retrieve the variable declared in this "switch" statement, if any.
Stmt * getInit()
Definition Stmt.h:2579
SourceLocation getBeginLoc() const
Definition Stmt.h:2663
bool hasInitStorage() const
True if this SwitchStmt has storage for an init statement.
Definition Stmt.h:2557
SwitchCase * getSwitchCaseList()
Definition Stmt.h:2630
const SwitchCase * getSwitchCaseList() const
Definition Stmt.h:2631
DeclStmt * getConditionVariableDeclStmt()
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
Definition Stmt.h:2613
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:2655
void setSwitchCaseList(SwitchCase *SC)
Definition Stmt.h:2632
static bool classof(const Stmt *T)
Definition Stmt.h:2680
Token - This structure provides full information about a lexed token.
Represents a statement that could possibly have a value and type.
Definition Stmt.h:2117
const Expr * getExprStmt() const
Stmt(StmtClass SC, EmptyShell)
Construct an empty statement.
Definition Stmt.h:1465
static bool classof(const Stmt *T)
Definition Stmt.h:2128
Expr * getExprStmt()
Definition Stmt.h:2123
Represents a variable declaration or definition.
Expr * getCond()
Definition Stmt.h:2739
SourceLocation getWhileLoc() const
Definition Stmt.h:2792
void setCond(Expr *Cond)
Definition Stmt.h:2747
SourceLocation getRParenLoc() const
Definition Stmt.h:2797
DeclStmt * getConditionVariableDeclStmt()
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
Definition Stmt.h:2775
void setBody(Stmt *Body)
Definition Stmt.h:2754
void setLParenLoc(SourceLocation L)
Definition Stmt.h:2796
VarDecl * getConditionVariable()
Retrieve the variable declared in this "while" statement, if any.
SourceLocation getEndLoc() const LLVM_READONLY
Definition Stmt.h:2801
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:2737
SourceLocation getLParenLoc() const
Definition Stmt.h:2795
SourceLocation getBeginLoc() const
Definition Stmt.h:2800
const Stmt * getBody() const
Definition Stmt.h:2752
void setRParenLoc(SourceLocation L)
Definition Stmt.h:2798
const VarDecl * getConditionVariable() const
Definition Stmt.h:2765
void setWhileLoc(SourceLocation L)
Definition Stmt.h:2793
const Expr * getCond() const
Definition Stmt.h:2743
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:2781
void setConditionVariableDeclStmt(DeclStmt *CondVar)
Definition Stmt.h:2787
static bool classof(const Stmt *T)
Definition Stmt.h:2805
const_child_range children() const
Definition Stmt.h:2815
child_range children()
Definition Stmt.h:2810
Stmt * getBody()
Definition Stmt.h:2751
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:1441
typename CastIterator::iterator_adaptor_base Base
Definition Stmt.h:1442
CastIterator(StmtPtr *I)
Definition Stmt.h:1445
CastIterator()
Definition Stmt.h:1444
Base::value_type operator*() const
Definition Stmt.h:1447
A placeholder type used to construct an empty shell of a type, that will be filled in later (e....
Definition Stmt.h:1423