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
30#include "llvm/ADT/APFloat.h"
31#include "llvm/ADT/ArrayRef.h"
32#include "llvm/ADT/BitmaskEnum.h"
33#include "llvm/ADT/PointerIntPair.h"
34#include "llvm/ADT/StringRef.h"
35#include "llvm/ADT/iterator.h"
36#include "llvm/ADT/iterator_range.h"
37#include "llvm/Support/Casting.h"
38#include "llvm/Support/Compiler.h"
39#include "llvm/Support/ErrorHandling.h"
40#include
41#include
42#include
43#include
44#include
45#include
46
47namespace llvm {
48
49class FoldingSetNodeID;
50
51}
52
54
55class ASTContext;
56class Attr;
57class CapturedDecl;
59class Expr;
60class AddrLabelExpr;
61class LabelDecl;
62class ODRHash;
63class PrinterHelper;
64struct PrintingPolicy;
65class RecordDecl;
66class SourceManager;
67class StringLiteral;
68class Token;
69class VarDecl;
77
78
79
80
81
82
83
84class alignas(void *) Stmt {
85public:
88#define STMT(CLASS, PARENT) CLASS##Class,
89#define STMT_RANGE(BASE, FIRST, LAST) \
90 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class,
91#define LAST_STMT_RANGE(BASE, FIRST, LAST) \
92 first##BASE##Constant=FIRST##Class, last##BASE##Constant=LAST##Class
93#define ABSTRACT_STMT(STMT)
94#include "clang/AST/StmtNodes.inc"
95 };
96
97
98protected:
101
102 void *operator new(size_t bytes) noexcept {
103 llvm_unreachable("Stmts cannot be allocated with regular 'new'.");
104 }
105
106 void operator delete(void *data) noexcept {
107 llvm_unreachable("Stmts cannot be released with regular 'delete'.");
108 }
109
110
111
112 #define NumStmtBits 9
113
118
119
122 };
123
128
131
132
133
134
135
136
137 LLVM_PREFERRED_TYPE(bool)
138 unsigned HasLeadingEmptyMacro : 1;
139
140
142 };
143
147
150
151
152
153 LLVM_PREFERRED_TYPE(bool)
154 unsigned HasFPFeatures : 1;
155
156 unsigned NumStmts;
157 };
158
161
164
166 };
167
171
174
175
177
178
180 };
181
185
188
189
191 unsigned Kind : 3;
192
193
194 LLVM_PREFERRED_TYPE(bool)
195 unsigned HasElse : 1;
196
197
198 LLVM_PREFERRED_TYPE(bool)
199 unsigned HasVar : 1;
200
201
202 LLVM_PREFERRED_TYPE(bool)
203 unsigned HasInit : 1;
204
205
207 };
208
211
214
215
216 LLVM_PREFERRED_TYPE(bool)
217 unsigned HasInit : 1;
218
219
220 LLVM_PREFERRED_TYPE(bool)
221 unsigned HasVar : 1;
222
223
224
225
226 LLVM_PREFERRED_TYPE(bool)
227 unsigned AllEnumCasesCovered : 1;
228
229
231 };
232
236
239
240
241 LLVM_PREFERRED_TYPE(bool)
242 unsigned HasVar : 1;
243
244
246 };
247
250
253
254
256 };
257
260
263
264
266 };
267
271
274
275
277 };
278
281
284
285
287 };
288
291
294
295
297 };
298
301
304
305
306 LLVM_PREFERRED_TYPE(bool)
307 unsigned HasNRVOCandidate : 1;
308
309
311 };
312
316
319
320
321
322 LLVM_PREFERRED_TYPE(bool)
323 unsigned CaseStmtIsGNURange : 1;
324
325
327 };
328
329
330
354
357
359 unsigned ValueKind : 2;
361 unsigned ObjectKind : 3;
363 unsigned Dependent : llvm::BitWidth;
364 };
366
371
374
375
377 unsigned ResultKind : 2;
378
379
381 unsigned APValueKind : 4;
382
383
384
385 LLVM_PREFERRED_TYPE(bool)
386 unsigned IsUnsigned : 1;
387
388
389
390
391
392 unsigned BitWidth : 7;
393
394
395
396 LLVM_PREFERRED_TYPE(bool)
397 unsigned HasCleanup : 1;
398
399
400 LLVM_PREFERRED_TYPE(bool)
401 unsigned IsImmediateInvocation : 1;
402 };
403
407
410
412 unsigned Kind : 4;
413
414
415
416 LLVM_PREFERRED_TYPE(bool)
417 unsigned HasFunctionName : 1;
418
419
420
421 LLVM_PREFERRED_TYPE(bool)
422 unsigned IsTransparent : 1;
423
424
426 };
427
431
434
435 LLVM_PREFERRED_TYPE(bool)
436 unsigned HasQualifier : 1;
437 LLVM_PREFERRED_TYPE(bool)
438 unsigned HasTemplateKWAndArgsInfo : 1;
439 LLVM_PREFERRED_TYPE(bool)
440 unsigned HasFoundDecl : 1;
441 LLVM_PREFERRED_TYPE(bool)
442 unsigned HadMultipleCandidates : 1;
443 LLVM_PREFERRED_TYPE(bool)
444 unsigned RefersToEnclosingVariableOrCapture : 1;
445 LLVM_PREFERRED_TYPE(bool)
446 unsigned CapturedByCopyInLambdaWithExplicitObjectParameter : 1;
449 LLVM_PREFERRED_TYPE(bool)
450 unsigned IsImmediateEscalating : 1;
451
452
454 };
455
456
459
462
463 static_assert(
464 llvm::APFloat::S_MaxSemantics < 32,
465 "Too many Semantics enum values to fit in bitfield of size 5");
466 LLVM_PREFERRED_TYPE(llvm::APFloat::Semantics)
467 unsigned Semantics : 5;
468 LLVM_PREFERRED_TYPE(bool)
469 unsigned IsExact : 1;
470 };
471
475
478
479
480
482 unsigned Kind : 3;
483
484
485
486
487 unsigned CharByteWidth : 3;
488
489 LLVM_PREFERRED_TYPE(bool)
490 unsigned IsPascal : 1;
491
492
493
494 unsigned NumConcatenated;
495 };
496
499
502
504 unsigned Kind : 3;
505 };
506
509
512
514 unsigned Opc : 5;
515 LLVM_PREFERRED_TYPE(bool)
516 unsigned CanOverflow : 1;
517
518
519
520
521 LLVM_PREFERRED_TYPE(bool)
522 unsigned HasFPFeatures : 1;
523
525 };
526
529
532
534 unsigned Kind : 3;
535 LLVM_PREFERRED_TYPE(bool)
536 unsigned IsType : 1;
537 };
538
542
545
547 };
548
551
554
555 unsigned NumPreArgs : 1;
556
557
558 LLVM_PREFERRED_TYPE(bool)
559 unsigned UsesADL : 1;
560
561
562 LLVM_PREFERRED_TYPE(bool)
563 unsigned HasFPFeatures : 1;
564
565
566 unsigned IsCoroElideSafe : 1;
567
568
570
571
572
573
574 unsigned OffsetToTrailingObjects : 8;
575 };
577
581
584
585
586 LLVM_PREFERRED_TYPE(bool)
587 unsigned IsArrow : 1;
588
589
590
591 LLVM_PREFERRED_TYPE(bool)
592 unsigned HasQualifier : 1;
593
594
595 LLVM_PREFERRED_TYPE(bool)
596 unsigned HasFoundDecl : 1;
597
598
599
600
601
602
603 LLVM_PREFERRED_TYPE(bool)
604 unsigned HasTemplateKWAndArgsInfo : 1;
605
606
607
608 LLVM_PREFERRED_TYPE(bool)
609 unsigned HadMultipleCandidates : 1;
610
611
612
613
616
617
619 };
620
624
627
628 LLVM_PREFERRED_TYPE(CastKind)
629 unsigned Kind : 7;
630 LLVM_PREFERRED_TYPE(bool)
631 unsigned PartOfExplicitCast : 1;
632
633
634 LLVM_PREFERRED_TYPE(bool)
635 unsigned HasFPFeatures : 1;
636
637
638
639 unsigned BasePathSize;
640 };
641
644
647
649 unsigned Opc : 6;
650
651
652
653
654 LLVM_PREFERRED_TYPE(bool)
655 unsigned HasFPFeatures : 1;
656
657
658
659 LLVM_PREFERRED_TYPE(bool)
660 unsigned ExcludedOverflowPattern : 1;
661
663 };
664
667
670
671
672
673 LLVM_PREFERRED_TYPE(bool)
674 unsigned HadArrayRangeDesignator : 1;
675 };
676
680
683
684
685 unsigned NumExprs;
686 };
687
691
694
695
697 };
698
702
705
706 unsigned NumSubExprs : 16;
707 unsigned ResultIndex : 16;
708 };
709
713
716
717
718
720 unsigned Kind : 3;
721 };
722
727
730
731 LLVM_PREFERRED_TYPE(bool)
732 unsigned ProducedByFoldExpansion : 1;
733 };
734
738
741
742
743
744
745 unsigned TemplateDepth;
746 };
747
748
749
753
756
757
758
760 unsigned OperatorKind : 6;
761 };
762
766
769
770 LLVM_PREFERRED_TYPE(bool)
771 unsigned IsReversed : 1;
772 };
773
776
779
780
781 LLVM_PREFERRED_TYPE(bool)
782 unsigned Value : 1;
783
784
786 };
787
790
793
794
796 };
797
800
803
804
805 LLVM_PREFERRED_TYPE(bool)
806 unsigned IsImplicit : 1;
807
808
809
810 LLVM_PREFERRED_TYPE(bool)
811 unsigned CapturedByCopyInLambdaWithExplicitObjectParameter : 1;
812
813
815 };
816
820
823
824
825 LLVM_PREFERRED_TYPE(bool)
826 unsigned IsThrownVariableInScope : 1;
827
828
830 };
831
835
838
839
840 LLVM_PREFERRED_TYPE(bool)
841 unsigned HasRewrittenInit : 1;
842
843
845 };
846
850
853
854
855
856 LLVM_PREFERRED_TYPE(bool)
857 unsigned HasRewrittenInit : 1;
858
859
861 };
862
866
869
871 };
872
877
880
881
882 LLVM_PREFERRED_TYPE(bool)
883 unsigned IsGlobalNew : 1;
884
885
886
887 LLVM_PREFERRED_TYPE(bool)
888 unsigned IsArray : 1;
889
890
891 LLVM_PREFERRED_TYPE(bool)
892 unsigned ShouldPassAlignment : 1;
893
894
895
896 LLVM_PREFERRED_TYPE(bool)
897 unsigned UsualArrayDeleteWantsSize : 1;
898
899
900 LLVM_PREFERRED_TYPE(bool)
901 unsigned HasInitializer : 1;
902
903
905 unsigned StoredInitializationStyle : 2;
906
907
908 LLVM_PREFERRED_TYPE(bool)
909 unsigned IsParenTypeId : 1;
910
911
912 unsigned NumPlacementArgs;
913 };
914
918
921
922
923 LLVM_PREFERRED_TYPE(bool)
924 unsigned GlobalDelete : 1;
925
926
927 LLVM_PREFERRED_TYPE(bool)
928 unsigned ArrayForm : 1;
929
930
931
932
933 LLVM_PREFERRED_TYPE(bool)
934 unsigned ArrayFormAsWritten : 1;
935
936
937
938 LLVM_PREFERRED_TYPE(bool)
939 unsigned UsualArrayDeleteWantsSize : 1;
940
941
943 };
944
949
952
953
955 unsigned Kind : 8;
956
957
958
959 LLVM_PREFERRED_TYPE(bool)
960 unsigned Value : 1;
961
962
963
964
965 unsigned NumArgs;
966 };
967
972
975
976
977
978 LLVM_PREFERRED_TYPE(bool)
979 unsigned HasTemplateKWAndArgsInfo : 1;
980 };
981
985
988
989 LLVM_PREFERRED_TYPE(bool)
990 unsigned Elidable : 1;
991 LLVM_PREFERRED_TYPE(bool)
992 unsigned HadMultipleCandidates : 1;
993 LLVM_PREFERRED_TYPE(bool)
994 unsigned ListInitialization : 1;
995 LLVM_PREFERRED_TYPE(bool)
996 unsigned StdInitListInitialization : 1;
997 LLVM_PREFERRED_TYPE(bool)
998 unsigned ZeroInitialization : 1;
1000 unsigned ConstructionKind : 3;
1001 LLVM_PREFERRED_TYPE(bool)
1002 unsigned IsImmediateEscalating : 1;
1003
1005 };
1006
1010
1013
1014
1015 LLVM_PREFERRED_TYPE(bool)
1016 unsigned CleanupsHaveSideEffects : 1;
1017
1018 unsigned NumObjects : 32 - 1 - NumExprBits;
1019 };
1020
1024
1027
1028
1029 unsigned NumArgs;
1030 };
1031
1035
1038
1039
1040
1041 LLVM_PREFERRED_TYPE(bool)
1042 unsigned IsArrow : 1;
1043
1044
1045
1046 LLVM_PREFERRED_TYPE(bool)
1047 unsigned HasTemplateKWAndArgsInfo : 1;
1048
1049
1050
1051 LLVM_PREFERRED_TYPE(bool)
1052 unsigned HasFirstQualifierFoundInScope : 1;
1053
1054
1056 };
1057
1061
1064
1065
1066
1067 LLVM_PREFERRED_TYPE(bool)
1068 unsigned HasTemplateKWAndArgsInfo : 1;
1069
1070
1071
1072
1074
1075
1076 unsigned NumResults;
1077 };
1079
1083
1086
1087
1088
1089 LLVM_PREFERRED_TYPE(bool)
1090 unsigned RequiresADL : 1;
1091 };
1093 "UnresolvedLookupExprBitfields must be <= than 4 bytes to"
1094 "avoid trashing OverloadExprBitfields::NumResults!");
1095
1099
1102
1103
1104
1105 LLVM_PREFERRED_TYPE(bool)
1106 unsigned IsArrow : 1;
1107
1108
1109 LLVM_PREFERRED_TYPE(bool)
1110 unsigned HasUnresolvedUsing : 1;
1111 };
1113 "UnresolvedMemberExprBitfields must be <= than 4 bytes to"
1114 "avoid trashing OverloadExprBitfields::NumResults!");
1115
1119
1122
1123 LLVM_PREFERRED_TYPE(bool)
1124 unsigned Value : 1;
1125 };
1126
1130
1133
1134
1136 };
1137
1142
1145
1146
1147
1149 unsigned CaptureDefault : 2;
1150
1151
1152
1153 LLVM_PREFERRED_TYPE(bool)
1154 unsigned ExplicitParams : 1;
1155
1156
1157 LLVM_PREFERRED_TYPE(bool)
1158 unsigned ExplicitResultType : 1;
1159
1160
1161 unsigned NumCaptures : 16;
1162 };
1163
1168
1171
1172 LLVM_PREFERRED_TYPE(bool)
1173 unsigned IsSatisfied : 1;
1175 };
1176
1177
1178
1181
1184
1185 LLVM_PREFERRED_TYPE(bool)
1186 unsigned IsImplicit : 1;
1187 };
1188
1189
1190
1193
1196
1197 LLVM_PREFERRED_TYPE(bool)
1198 unsigned ShouldCopy : 1;
1199 };
1200
1201
1202
1206
1209
1210
1211
1212 LLVM_PREFERRED_TYPE(bool)
1213 unsigned IsUnique : 1;
1214
1216 };
1217
1218 union {
1219
1220
1236
1237
1258
1259
1261
1262
1287
1288
1290
1291
1293
1294
1296 };
1297
1298public:
1299
1300
1302 unsigned alignment = 8);
1303
1305 unsigned alignment = 8) {
1306 return operator new(bytes, *C, alignment);
1307 }
1308
1309 void *operator new(size_t bytes, void *mem) noexcept { return mem; }
1310
1313 void operator delete(void *, size_t) noexcept {}
1314 void operator delete(void *, void *) noexcept {}
1315
1316public:
1317
1318
1319
1321
1322
1324 LH_Unlikely = -1,
1325 LH_None,
1327 LH_Likely
1329
1330protected:
1331
1332
1333
1334
1335 template<typename T, typename TPtr = T *, typename StmtPtr = Stmt *>
1337 : llvm::iterator_adaptor_base<CastIterator<T, TPtr, StmtPtr>, StmtPtr *,
1338 std::random_access_iterator_tag, TPtr> {
1339 using Base = typename CastIterator::iterator_adaptor_base;
1340
1343
1345 return cast_or_null(*this->I);
1346 }
1347 };
1348
1349
1350 template
1352
1355
1356private:
1357
1358 static bool StatisticsEnabled;
1359
1360protected:
1361
1363
1364public:
1370
1372 static_assert(sizeof(*this) <= 8,
1373 "changing bitfields changed sizeof(Stmt)");
1374 static_assert(sizeof(*this) % alignof(void *) == 0,
1375 "Insufficient alignment!");
1378 }
1379
1382 }
1383
1385
1386
1387
1388
1392
1393
1397
1398
1400
1401
1403
1404
1406
1407
1408
1409
1411
1412
1413
1414
1415 static std::tuple<bool, const Attr *, const Attr *>
1417
1418
1419
1420 void dump() const;
1421 void dump(raw_ostream &OS, const ASTContext &Context) const;
1422
1423
1425
1426
1428
1429
1430
1433 const PrintingPolicy &Policy, unsigned Indentation = 0,
1434 StringRef NewlineSymbol = "\n",
1435 const ASTContext *Context = nullptr) const;
1438 unsigned Indentation = 0,
1439 StringRef NewlineSymbol = "\n",
1440 const ASTContext *Context = nullptr) const;
1441
1442
1444 const PrintingPolicy &Policy, bool AddQuotes) const;
1445
1446
1447
1449
1450
1451
1455 }
1456
1459 return const_cast<Stmt*>(
1461 }
1462
1463
1464
1465
1468
1469 using child_range = llvm::iterator_range<child_iterator>;
1471
1473
1475 auto Children = const_cast<Stmt *>(this)->children();
1477 }
1478
1481
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1503 bool Canonical, bool ProfileLambdaExpr = false) const;
1504
1505
1506
1507
1508
1509
1510
1511
1513};
1514
1515
1516
1517
1518
1522
1523public:
1525 : Stmt(DeclStmtClass), DG(dg), StartLoc(startLoc), EndLoc(endLoc) {}
1526
1527
1529
1530
1531
1533
1536
1540
1544
1546
1548 return T->getStmtClass() == DeclStmtClass;
1549 }
1550
1551
1555 }
1556
1560 }
1561
1564 using decl_range = llvm::iterator_range<decl_iterator>;
1566
1568
1571 }
1572
1577
1579
1582 }
1583
1586 }
1587};
1588
1589
1590
1592public:
1594 : Stmt(NullStmtClass) {
1597 }
1598
1599
1601
1604
1607 }
1608
1611
1613 return T->getStmtClass() == NullStmtClass;
1614 }
1615
1618 }
1619
1622 }
1623};
1624
1625
1627 : public Stmt,
1628 private llvm::TrailingObjects<CompoundStmt, Stmt *, FPOptionsOverride> {
1630 friend TrailingObjects;
1631
1632
1634
1635
1637
1641
1643
1644
1647 *getTrailingObjects() = F;
1648 }
1649
1650 size_t numTrailingObjects(OverloadToken<Stmt *>) const {
1652 }
1653
1654public:
1655 static CompoundStmt *Create(const ASTContext &C, ArrayRef<Stmt *> Stmts,
1656 FPOptionsOverride FPFeatures, SourceLocation LB,
1657 SourceLocation RB);
1658
1659
1661
1663 : Stmt(CompoundStmtClass), LBraceLoc(Loc), RBraceLoc(EndLoc) {
1666 }
1667
1668
1670 bool HasFPFeatures);
1671
1674
1676
1677
1680 return *getTrailingObjects();
1681 }
1682
1683
1686 }
1687
1689 using body_range = llvm::iterator_range<body_iterator>;
1690
1695
1698 }
1699
1702
1705 }
1706
1708 return getTrailingObjects<Stmt *>();
1709 }
1710
1712
1715 }
1716
1719 }
1720
1722
1725 }
1726
1729 }
1730
1732 std::reverse_iterator<const_body_iterator>;
1733
1736 }
1737
1740 }
1741
1742
1743
1744
1745
1746
1747
1748
1749
1751 for (auto *B : llvm::reverse(body())) {
1752 if (!isa(B))
1753 return B;
1754 }
1756 }
1757
1760 }
1761
1764
1767
1769 return T->getStmtClass() == CompoundStmtClass;
1770 }
1771
1772
1774
1777 }
1778};
1779
1780
1782protected:
1783
1785
1786
1787
1788
1789
1790
1792
1796 }
1797
1799
1800public:
1804
1809
1813 }
1814
1817
1819 return T->getStmtClass() == CaseStmtClass ||
1820 T->getStmtClass() == DefaultStmtClass;
1821 }
1822};
1823
1824
1825
1828 private llvm::TrailingObjects<CaseStmt, Stmt *, SourceLocation> {
1829 friend TrailingObjects;
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846 enum { LhsOffset = 0, SubStmtOffsetFromRhs = 1 };
1847 enum { NumMandatoryStmtPtr = 2 };
1848
1849 unsigned numTrailingObjects(OverloadToken<Stmt *>) const {
1851 }
1852
1853 unsigned numTrailingObjects(OverloadToken) const {
1855 }
1856
1857 unsigned lhsOffset() const { return LhsOffset; }
1858 unsigned rhsOffset() const { return LhsOffset + caseStmtIsGNURange(); }
1859 unsigned subStmtOffset() const { return rhsOffset() + SubStmtOffsetFromRhs; }
1860
1861
1862
1865 : SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
1866
1867 bool IsGNURange = rhs != nullptr;
1871 if (IsGNURange) {
1874 }
1875 }
1876
1877
1880 SwitchCaseBits.CaseStmtIsGNURange = CaseStmtIsGNURange;
1881 }
1882
1883public:
1884
1888
1889
1891
1892
1893
1894
1896
1899
1900
1904 }
1905
1906
1907
1909 assert(
1911 "setEllipsisLoc but this is not a case stmt of the form LHS ... RHS!");
1912 *getTrailingObjects() = L;
1913 }
1914
1916 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1917 }
1918
1920 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[lhsOffset()]);
1921 }
1922
1924 getTrailingObjects<Stmt *>()[lhsOffset()] = reinterpret_cast<Stmt *>(Val);
1925 }
1926
1929 getTrailingObjects<Stmt *>()[rhsOffset()])
1930 : nullptr;
1931 }
1932
1935 getTrailingObjects<Stmt *>()[rhsOffset()])
1936 : nullptr;
1937 }
1938
1941 "setRHS but this is not a case stmt of the form LHS ... RHS!");
1942 getTrailingObjects<Stmt *>()[rhsOffset()] = reinterpret_cast<Stmt *>(Val);
1943 }
1944
1945 Stmt *getSubStmt() { return getTrailingObjects<Stmt *>()[subStmtOffset()]; }
1947 return getTrailingObjects<Stmt *>()[subStmtOffset()];
1948 }
1949
1951 getTrailingObjects<Stmt *>()[subStmtOffset()] = S;
1952 }
1953
1956
1958 while (const auto *CS2 = dyn_cast(CS->getSubStmt()))
1959 CS = CS2;
1960
1962 }
1963
1965 return T->getStmtClass() == CaseStmtClass;
1966 }
1967
1968
1970 return child_range(getTrailingObjects<Stmt *>(),
1971 getTrailingObjects<Stmt *>() +
1972 numTrailingObjects(OverloadToken<Stmt *>()));
1973 }
1974
1977 getTrailingObjects<Stmt *>() +
1978 numTrailingObjects(OverloadToken<Stmt *>()));
1979 }
1980};
1981
1983 Stmt *SubStmt;
1984
1985public:
1987 : SwitchCase(DefaultStmtClass, DL, CL), SubStmt(substmt) {}
1988
1989
1992
1996
1999
2003 }
2004
2006 return T->getStmtClass() == DefaultStmtClass;
2007 }
2008
2009
2011
2014 }
2015};
2016
2018 if (const auto *CS = dyn_cast(this))
2019 return CS->getEndLoc();
2020 else if (const auto *DS = dyn_cast(this))
2021 return DS->getEndLoc();
2022 llvm_unreachable("SwitchCase is neither a CaseStmt nor a DefaultStmt!");
2023}
2024
2026 if (auto *CS = dyn_cast(this))
2027 return CS->getSubStmt();
2028 else if (auto *DS = dyn_cast(this))
2029 return DS->getSubStmt();
2030 llvm_unreachable("SwitchCase is neither a CaseStmt nor a DefaultStmt!");
2031}
2032
2033
2034
2035
2036
2037
2038
2040protected:
2042
2043public:
2046 const ValueStmt *ConstThis = this;
2048 }
2049
2051 return T->getStmtClass() >= firstValueStmtConstant &&
2052 T->getStmtClass() <= lastValueStmtConstant;
2053 }
2054};
2055
2056
2057
2060 Stmt *SubStmt;
2061 bool SideEntry = false;
2062
2063public:
2064
2066 : ValueStmt(LabelStmtClass), TheDecl(D), SubStmt(substmt) {
2068 }
2069
2070
2072
2075
2078
2079 const char *getName() const;
2081
2084
2087
2089
2092 }
2093
2095 return T->getStmtClass() == LabelStmtClass;
2096 }
2099};
2100
2101
2102
2103
2104
2107 private llvm::TrailingObjects<AttributedStmt, const Attr *> {
2109 friend TrailingObjects;
2110
2111 Stmt *SubStmt;
2112
2114 Stmt *SubStmt)
2115 : ValueStmt(AttributedStmtClass), SubStmt(SubStmt) {
2118 std::copy(Attrs.begin(), Attrs.end(), getAttrArrayPtr());
2119 }
2120
2125 std::fill_n(getAttrArrayPtr(), NumAttrs, nullptr);
2126 }
2127
2128 const Attr *const *getAttrArrayPtr() const {
2129 return getTrailingObjects<const Attr *>();
2130 }
2131 const Attr **getAttrArrayPtr() { return getTrailingObjects<const Attr *>(); }
2132
2133public:
2134 static AttributedStmt *Create(const ASTContext &C, SourceLocation Loc,
2135 ArrayRef<const Attr *> Attrs, Stmt *SubStmt);
2136
2137
2138 static AttributedStmt *CreateEmpty(const ASTContext &C, unsigned NumAttrs);
2139
2143 }
2144
2147
2150
2152
2155 }
2156
2158 return T->getStmtClass() == AttributedStmtClass;
2159 }
2160};
2161
2162
2164 : public Stmt,
2165 private llvm::TrailingObjects<IfStmt, Stmt *, SourceLocation> {
2166 friend TrailingObjects;
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190 enum { InitOffset = 0, ThenOffsetFromCond = 1, ElseOffsetFromCond = 2 };
2191 enum { NumMandatoryStmtPtr = 2 };
2194
2195 unsigned numTrailingObjects(OverloadToken<Stmt *>) const {
2198 }
2199
2200 unsigned numTrailingObjects(OverloadToken) const {
2202 }
2203
2204 unsigned initOffset() const { return InitOffset; }
2205 unsigned varOffset() const { return InitOffset + hasInitStorage(); }
2206 unsigned condOffset() const {
2208 }
2209 unsigned thenOffset() const { return condOffset() + ThenOffsetFromCond; }
2210 unsigned elseOffset() const { return condOffset() + ElseOffsetFromCond; }
2211
2212
2216
2217
2219
2220public:
2221
2226 Stmt *Else = nullptr);
2227
2228
2229
2231 bool HasInit);
2232
2233
2235
2236
2238
2239
2241
2243 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
2244 }
2245
2247 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
2248 }
2249
2251 getTrailingObjects<Stmt *>()[condOffset()] = reinterpret_cast<Stmt *>(Cond);
2252 }
2253
2254 Stmt *getThen() { return getTrailingObjects<Stmt *>()[thenOffset()]; }
2256 return getTrailingObjects<Stmt *>()[thenOffset()];
2257 }
2258
2260 getTrailingObjects<Stmt *>()[thenOffset()] = Then;
2261 }
2262
2264 return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
2265 : nullptr;
2266 }
2267
2269 return hasElseStorage() ? getTrailingObjects<Stmt *>()[elseOffset()]
2270 : nullptr;
2271 }
2272
2275 "This if statement has no storage for an else statement!");
2276 getTrailingObjects<Stmt *>()[elseOffset()] = Else;
2277 }
2278
2279
2280
2281
2282
2283
2284
2285
2286
2290 }
2291
2292
2293
2295
2296
2297
2300 getTrailingObjects<Stmt *>()[varOffset()])
2301 : nullptr;
2302 }
2303
2306 getTrailingObjects<Stmt *>()[varOffset()])
2307 : nullptr;
2308 }
2309
2312 getTrailingObjects<Stmt *>()[varOffset()] = CondVar;
2313 }
2314
2316 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2317 : nullptr;
2318 }
2319
2321 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2322 : nullptr;
2323 }
2324
2327 "This if statement has no storage for an init statement!");
2328 getTrailingObjects<Stmt *>()[initOffset()] = Init;
2329 }
2330
2333
2335 return hasElseStorage() ? *getTrailingObjects()
2337 }
2338
2341 "This if statement has no storage for an else statement!");
2342 *getTrailingObjects() = ElseLoc;
2343 }
2344
2348 }
2349
2352 }
2353
2356 }
2357
2360 }
2361
2364 }
2365
2368 }
2369
2370
2371
2374
2376
2382 }
2387
2388
2389
2391
2392
2393 return child_range(getTrailingObjects<Stmt *>() +
2395 getTrailingObjects<Stmt *>() +
2396 numTrailingObjects(OverloadToken<Stmt *>()));
2397 }
2398
2400
2401
2404 getTrailingObjects<Stmt *>() +
2405 numTrailingObjects(OverloadToken<Stmt *>()));
2406 }
2407
2409 return T->getStmtClass() == IfStmtClass;
2410 }
2411};
2412
2413
2415 private llvm::TrailingObjects<SwitchStmt, Stmt *> {
2416 friend TrailingObjects;
2417
2418
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438 enum { InitOffset = 0, BodyOffsetFromCond = 1 };
2439 enum { NumMandatoryStmtPtr = 2 };
2442
2443 unsigned numTrailingObjects(OverloadToken<Stmt *>) const {
2445 }
2446
2447 unsigned initOffset() const { return InitOffset; }
2448 unsigned varOffset() const { return InitOffset + hasInitStorage(); }
2449 unsigned condOffset() const {
2451 }
2452 unsigned bodyOffset() const { return condOffset() + BodyOffsetFromCond; }
2453
2454
2457
2458
2460
2461public:
2462
2466
2467
2468
2470 bool HasVar);
2471
2472
2474
2475
2477
2479 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
2480 }
2481
2483 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
2484 }
2485
2487 getTrailingObjects<Stmt *>()[condOffset()] = reinterpret_cast<Stmt *>(Cond);
2488 }
2489
2490 Stmt *getBody() { return getTrailingObjects<Stmt *>()[bodyOffset()]; }
2492 return getTrailingObjects<Stmt *>()[bodyOffset()];
2493 }
2494
2496 getTrailingObjects<Stmt *>()[bodyOffset()] = Body;
2497 }
2498
2500 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2501 : nullptr;
2502 }
2503
2505 return hasInitStorage() ? getTrailingObjects<Stmt *>()[initOffset()]
2506 : nullptr;
2507 }
2508
2511 "This switch statement has no storage for an init statement!");
2512 getTrailingObjects<Stmt *>()[initOffset()] = Init;
2513 }
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2527 }
2528
2529
2530
2532
2533
2534
2537 getTrailingObjects<Stmt *>()[varOffset()])
2538 : nullptr;
2539 }
2540
2543 getTrailingObjects<Stmt *>()[varOffset()])
2544 : nullptr;
2545 }
2546
2549 getTrailingObjects<Stmt *>()[varOffset()] = CondVar;
2550 }
2551
2555
2562
2566 }
2567
2570 "case/default already added to a switch");
2572 FirstCase = SC;
2573 }
2574
2575
2576
2578
2579
2580
2583 }
2584
2589 }
2590
2591
2593 return child_range(getTrailingObjects<Stmt *>(),
2594 getTrailingObjects<Stmt *>() +
2595 numTrailingObjects(OverloadToken<Stmt *>()));
2596 }
2597
2600 getTrailingObjects<Stmt *>() +
2601 numTrailingObjects(OverloadToken<Stmt *>()));
2602 }
2603
2605 return T->getStmtClass() == SwitchStmtClass;
2606 }
2607};
2608
2609
2611 private llvm::TrailingObjects<WhileStmt, Stmt *> {
2612 friend TrailingObjects;
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629 enum { VarOffset = 0, BodyOffsetFromCond = 1 };
2630 enum { NumMandatoryStmtPtr = 2 };
2631
2633
2634 unsigned varOffset() const { return VarOffset; }
2635 unsigned condOffset() const { return VarOffset + hasVarStorage(); }
2636 unsigned bodyOffset() const { return condOffset() + BodyOffsetFromCond; }
2637
2638 unsigned numTrailingObjects(OverloadToken<Stmt *>) const {
2640 }
2641
2642
2646
2647
2649
2650public:
2651
2655
2656
2657
2659
2660
2662
2664 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
2665 }
2666
2668 return reinterpret_cast<Expr *>(getTrailingObjects<Stmt *>()[condOffset()]);
2669 }
2670
2672 getTrailingObjects<Stmt *>()[condOffset()] = reinterpret_cast<Stmt *>(Cond);
2673 }
2674
2675 Stmt *getBody() { return getTrailingObjects<Stmt *>()[bodyOffset()]; }
2677 return getTrailingObjects<Stmt *>()[bodyOffset()];
2678 }
2679
2681 getTrailingObjects<Stmt *>()[bodyOffset()] = Body;
2682 }
2683
2684
2685
2686
2687
2688
2689
2690
2691
2695 }
2696
2697
2698
2700
2701
2702
2705 getTrailingObjects<Stmt *>()[varOffset()])
2706 : nullptr;
2707 }
2708
2711 getTrailingObjects<Stmt *>()[varOffset()])
2712 : nullptr;
2713 }
2714
2717 getTrailingObjects<Stmt *>()[varOffset()] = CondVar;
2718 }
2719
2722
2727
2731 }
2732
2734 return T->getStmtClass() == WhileStmtClass;
2735 }
2736
2737
2739 return child_range(getTrailingObjects<Stmt *>(),
2740 getTrailingObjects<Stmt *>() +
2741 numTrailingObjects(OverloadToken<Stmt *>()));
2742 }
2743
2746 getTrailingObjects<Stmt *>() +
2747 numTrailingObjects(OverloadToken<Stmt *>()));
2748 }
2749};
2750
2751
2753 enum { BODY, COND, END_EXPR };
2754 Stmt *SubExprs[END_EXPR];
2756 SourceLocation RParenLoc;
2757
2758public:
2761 : Stmt(DoStmtClass), WhileLoc(WL), RParenLoc(RP) {
2765 }
2766
2767
2769
2772 return reinterpret_cast<Expr *>(SubExprs[COND]);
2773 }
2774
2775 void setCond(Expr *Cond) { SubExprs[COND] = reinterpret_cast<Stmt *>(Cond); }
2776
2780
2787
2790
2792 return T->getStmtClass() == DoStmtClass;
2793 }
2794
2795
2797 return child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2798 }
2799
2801 return const_child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2802 }
2803};
2804
2805
2806
2807
2810
2811 enum { INIT, CONDVAR, COND, INC, BODY, END_EXPR };
2812 Stmt* SubExprs[END_EXPR];
2814
2815public:
2819
2820
2822
2824
2825
2826
2827
2828
2829
2830
2831
2832
2835
2836
2837
2839 return reinterpret_cast<DeclStmt*>(SubExprs[CONDVAR]);
2840 }
2841
2843 return reinterpret_cast<DeclStmt*>(SubExprs[CONDVAR]);
2844 }
2845
2847 SubExprs[CONDVAR] = CondVar;
2848 }
2849
2853
2855 const Expr *getCond() const { return reinterpret_cast<Expr*>(SubExprs[COND]);}
2856 const Expr *getInc() const { return reinterpret_cast<Expr*>(SubExprs[INC]); }
2858
2863
2870
2873
2875 return T->getStmtClass() == ForStmtClass;
2876 }
2877
2878
2880 return child_range(&SubExprs[0], &SubExprs[0]+END_EXPR);
2881 }
2882
2884 return const_child_range(&SubExprs[0], &SubExprs[0] + END_EXPR);
2885 }
2886};
2887
2888
2892
2893public:
2895 : Stmt(GotoStmtClass), Label(label), LabelLoc(LL) {
2897 }
2898
2899
2901
2904
2909
2912
2914 return T->getStmtClass() == GotoStmtClass;
2915 }
2916
2917
2920 }
2921
2924 }
2925};
2926
2927
2931
2932public:
2934 : Stmt(IndirectGotoStmtClass), StarLoc(starLoc) {
2937 }
2938
2939
2941 : Stmt(IndirectGotoStmtClass, Empty) {}
2942
2947
2950 return reinterpret_cast<const Expr *>(Target);
2951 }
2953
2954
2955
2959 }
2960
2963
2965 return T->getStmtClass() == IndirectGotoStmtClass;
2966 }
2967
2968
2970
2973 }
2974};
2975
2976
2978public:
2981 }
2982
2983
2985
2988
2991
2993 return T->getStmtClass() == ContinueStmtClass;
2994 }
2995
2996
2999 }
3000
3003 }
3004};
3005
3006
3008public:
3011 }
3012
3013
3015
3018
3021
3023 return T->getStmtClass() == BreakStmtClass;
3024 }
3025
3026
3029 }
3030
3033 }
3034};
3035
3036
3037
3038
3039
3040
3041
3042
3043
3045 : public Stmt,
3046 private llvm::TrailingObjects<ReturnStmt, const VarDecl *> {
3047 friend TrailingObjects;
3048
3049
3050 Stmt *RetExpr;
3051
3052
3053
3054
3055
3056 bool hasNRVOCandidate() const { return ReturnStmtBits.HasNRVOCandidate; }
3057
3058 unsigned numTrailingObjects(OverloadToken<const VarDecl *>) const {
3059 return hasNRVOCandidate();
3060 }
3061
3062
3064
3065
3067
3068public:
3069
3071 const VarDecl *NRVOCandidate);
3072
3073
3074
3076
3080
3081
3082
3083
3084
3085
3087 return hasNRVOCandidate() ? *getTrailingObjects<const VarDecl *>()
3088 : nullptr;
3089 }
3090
3091
3092
3093
3095 assert(hasNRVOCandidate() &&
3096 "This return statement has no storage for an NRVO candidate!");
3097 *getTrailingObjects<const VarDecl *>() = Var;
3098 }
3099
3102
3106 }
3107
3109 return T->getStmtClass() == ReturnStmtClass;
3110 }
3111
3112
3114 if (RetExpr)
3115 return child_range(&RetExpr, &RetExpr + 1);
3117 }
3118
3120 if (RetExpr)
3123 }
3124};
3125
3126
3128protected:
3130
3132
3133
3134
3136
3137
3138
3140
3144
3146
3148 unsigned numoutputs, unsigned numinputs, unsigned numclobbers)
3152
3153public:
3154
3156
3159
3162
3165
3168
3169
3170
3171
3173
3174
3175
3177
3178
3179
3180
3182
3183
3184
3185
3188 }
3189
3191
3192
3193
3195
3196
3197
3199
3200
3201
3203
3205
3206
3207
3209 StringRef getClobber(unsigned i) const;
3210
3212 return T->getStmtClass() == GCCAsmStmtClass ||
3213 T->getStmtClass() == MSAsmStmtClass;
3214 }
3215
3216
3217
3222
3225 }
3226
3229 }
3230
3232
3235 }
3236
3239 }
3240
3243 }
3244
3245
3246
3251
3253 return &Exprs[0];
3254 }
3255
3258 }
3259
3262 }
3263
3265 return &Exprs[0];
3266 }
3267
3270 }
3271
3274 }
3275
3278 }
3279
3282 }
3283};
3284
3285
3288
3291
3292
3296 unsigned NumLabels = 0;
3297
3298public:
3300 bool isvolatile, unsigned numoutputs, unsigned numinputs,
3305
3306
3308
3311
3312
3313
3317
3318
3319
3320
3322 public:
3325 Operand
3327
3328 private:
3329 Kind MyKind;
3330 std::string Str;
3331 unsigned OperandNo;
3332
3333
3335
3336 public:
3340 : MyKind(Operand), Str(S), OperandNo(OpNo),
3342
3345
3346 const std::string &getString() const { return Str; }
3347
3350 return OperandNo;
3351 }
3352
3354 assert(isOperand() && "Range is currently used only for Operands.");
3356 }
3357
3358
3359
3361 };
3362
3363
3364
3365
3366
3367
3369 const ASTContext &C, unsigned &DiagOffs) const;
3370
3371
3373
3374
3375
3377
3380 return II->getName();
3381
3382 return {};
3383 }
3384
3386
3388 return Constraints[i];
3389 }
3391 return Constraints[i];
3392 }
3393
3395
3398 }
3399
3400
3401
3404 }
3405
3408 return II->getName();
3409
3410 return {};
3411 }
3412
3414
3417 }
3420 }
3421
3424
3427 }
3428
3429
3430
3432 return NumLabels > 0;
3433 }
3434
3436 return NumLabels;
3437 }
3438
3441 }
3442
3449
3452 }
3453
3456 }
3457
3460 }
3461
3464 }
3465
3468 }
3469
3472 }
3473
3474private:
3475 void setOutputsAndInputsAndClobbers(const ASTContext &C,
3481 unsigned NumLabels,
3484
3485public:
3486
3487
3488
3489
3490
3492
3493 StringRef getClobber(unsigned i) const;
3494
3497 return Clobbers[i];
3498 }
3499
3502
3504 return T->getStmtClass() == GCCAsmStmtClass;
3505 }
3506};
3507
3508
3511
3513 StringRef AsmStr;
3514
3515 unsigned NumAsmToks = 0;
3516
3517 Token *AsmToks = nullptr;
3518 StringRef *Constraints = nullptr;
3519 StringRef *Clobbers = nullptr;
3520
3521public:
3523 SourceLocation lbraceloc, bool issimple, bool isvolatile,
3524 ArrayRef asmtoks, unsigned numoutputs, unsigned numinputs,
3528
3529
3531
3536
3538
3541
3542
3544
3545
3547
3548
3549
3552 return Constraints[i];
3553 }
3554
3556
3559 }
3560
3561
3562
3566 }
3567
3570
3573 }
3574
3575
3576
3579 }
3580
3583 }
3584
3588 }
3589
3591
3592private:
3593 void initialize(const ASTContext &C, StringRef AsmString,
3596
3597public:
3599
3601 return T->getStmtClass() == MSAsmStmtClass;
3602 }
3603
3606 }
3607
3610 }
3611};
3612
3616
3618 Stmt *Children[2];
3619
3620 enum { FILTER_EXPR, BLOCK };
3621
3624
3625public:
3626 static SEHExceptStmt* Create(const ASTContext &C,
3627 SourceLocation ExceptLoc,
3628 Expr *FilterExpr,
3630
3632
3635
3637 return reinterpret_cast<Expr*>(Children[FILTER_EXPR]);
3638 }
3639
3641 return cast(Children[BLOCK]);
3642 }
3643
3645 return child_range(Children, Children+2);
3646 }
3647
3650 }
3651
3653 return T->getStmtClass() == SEHExceptStmtClass;
3654 }
3655};
3656
3660
3663
3666
3667public:
3671
3673
3676
3678
3681 }
3682
3685 }
3686
3688 return T->getStmtClass() == SEHFinallyStmtClass;
3689 }
3690};
3691
3695
3696 bool IsCXXTry;
3698 Stmt *Children[2];
3699
3700 enum { TRY = 0, HANDLER = 1 };
3701
3702 SEHTryStmt(bool isCXXTry,
3704 Stmt *TryBlock,
3705 Stmt *Handler);
3706
3707 explicit SEHTryStmt(EmptyShell E) : Stmt(SEHTryStmtClass, E) {}
3708
3709public:
3710 static SEHTryStmt* Create(const ASTContext &C, bool isCXXTry,
3711 SourceLocation TryLoc, Stmt *TryBlock,
3712 Stmt *Handler);
3713
3715
3718
3720
3722 return cast(Children[TRY]);
3723 }
3724
3726
3727
3730
3732 return child_range(Children, Children+2);
3733 }
3734
3737 }
3738
3740 return T->getStmtClass() == SEHTryStmtClass;
3741 }
3742};
3743
3744
3747
3748public:
3750 : Stmt(SEHLeaveStmtClass), LeaveLoc(LL) {}
3751
3752
3754
3757
3760
3762 return T->getStmtClass() == SEHLeaveStmtClass;
3763 }
3764
3765
3768 }
3769
3772 }
3773};
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3785public:
3786
3787
3793 };
3794
3795
3796
3798 llvm::PointerIntPair<VarDecl *, 2, VariableCaptureKind> VarAndKind;
3800
3802
3803 public:
3806
3807
3808
3809
3810
3811
3812
3813
3815 VarDecl *Var = nullptr);
3816
3817
3819
3820
3821
3823
3824
3826
3827
3829
3830
3833 }
3834
3835
3836
3839 }
3840
3841
3842
3843
3845 };
3846
3847private:
3848
3849 unsigned NumCaptures;
3850
3851
3852
3853 llvm::PointerIntPair<CapturedDecl *, 2, CapturedRegionKind> CapDeclAndKind;
3854
3855
3856 RecordDecl *TheRecordDecl = nullptr;
3857
3858
3861
3862
3864
3865 Stmt **getStoredStmts() { return reinterpret_cast<Stmt **>(this + 1); }
3866
3867 Stmt *const *getStoredStmts() const {
3868 return reinterpret_cast<Stmt *const *>(this + 1);
3869 }
3870
3871 Capture *getStoredCaptures() const;
3872
3873 void setCapturedStmt(Stmt *S) { getStoredStmts()[NumCaptures] = S; }
3874
3875public:
3877
3883
3885 unsigned NumCaptures);
3886
3887
3890
3891
3894
3895
3897
3898
3900
3901
3903
3904
3906
3907
3909 assert(D && "null RecordDecl");
3910 TheRecordDecl = D;
3911 }
3912
3913
3915
3916
3921
3924 }
3927 }
3928
3929
3932
3933
3934
3936 return getStoredCaptures() + NumCaptures;
3937 }
3938
3939
3941
3942
3945
3946
3947
3950 llvm::iterator_range<const_capture_init_iterator>;
3951
3954 }
3955
3958 }
3959
3960
3962 return reinterpret_cast<Expr **>(getStoredStmts());
3963 }
3964
3966 return reinterpret_cast<Expr *const *>(getStoredStmts());
3967 }
3968
3969
3970
3973 }
3974
3977 }
3978
3981 }
3982
3985 }
3986
3989 }
3990
3992 return T->getStmtClass() == CapturedStmtClass;
3993 }
3994
3996
3998};
3999
4000}
4001
4002#endif
static StringRef bytes(const std::vector< T, Allocator > &v)
enum clang::sema::@1725::IndirectLocalPathEntry::EntryKind Kind
const LambdaCapture * Capture
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.
llvm::MachO::Target Target
Defines an enumeration for C++ overloaded operators.
Defines the clang::SourceLocation class and associated facilities.
Defines various enumerations that describe declaration and type specifiers.
#define BLOCK(DERIVED, BASE)
Defines enumerations for the type traits support.
__device__ __2f16 float __ockl_bool s
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Reads an AST files chain containing the contents of a translation unit.
AddrLabelExpr - The GNU address of label extension, representing &&label.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
outputs_iterator begin_outputs()
void setAsmLoc(SourceLocation L)
const_outputs_iterator end_outputs() const
outputs_iterator end_outputs()
const_inputs_iterator begin_inputs() const
unsigned getNumPlusOperands() const
getNumPlusOperands - Return the number of output operands that have a "+" constraint.
AsmStmt(StmtClass SC, SourceLocation asmloc, bool issimple, bool isvolatile, unsigned numoutputs, unsigned numinputs, unsigned numclobbers)
static bool classof(const Stmt *T)
StringRef getOutputConstraint(unsigned i) const
getOutputConstraint - Return the constraint string for the specified output operand.
inputs_const_range inputs() const
SourceLocation getAsmLoc() const
const Expr * getInputExpr(unsigned i) const
SourceLocation getEndLoc() const LLVM_READONLY
llvm::iterator_range< inputs_iterator > inputs_range
bool isOutputPlusConstraint(unsigned i) const
isOutputPlusConstraint - Return true if the specified output constraint is a "+" constraint (which is...
unsigned getNumClobbers() const
const_inputs_iterator end_inputs() const
llvm::iterator_range< const_inputs_iterator > inputs_const_range
const_child_range children() const
bool IsSimple
True if the assembly statement does not have any input or output operands.
const Expr * getOutputExpr(unsigned i) const
StringRef getInputConstraint(unsigned i) const
getInputConstraint - Return the specified input constraint.
outputs_const_range outputs() const
inputs_iterator end_inputs()
unsigned getNumOutputs() const
SourceLocation getBeginLoc() const LLVM_READONLY
inputs_iterator begin_inputs()
AsmStmt(StmtClass SC, EmptyShell Empty)
Build an empty inline-assembly statement.
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
bool IsVolatile
If true, treat this inline assembly as having side effects.
unsigned getNumInputs() const
llvm::iterator_range< outputs_iterator > outputs_range
StringRef getClobber(unsigned i) const
const_outputs_iterator begin_outputs() const
llvm::iterator_range< const_outputs_iterator > outputs_const_range
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Attr - This represents one attribute.
Represents an attribute applied to a statement.
static AttributedStmt * CreateEmpty(const ASTContext &C, unsigned NumAttrs)
const Stmt * getSubStmt() const
SourceLocation getAttrLoc() const
ArrayRef< const Attr * > getAttrs() const
const_child_range children() const
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getBeginLoc() const
A builtin binary operation expression such as "x + y" or "x <= y".
BreakStmt - This represents a break.
SourceLocation getBreakLoc() const
SourceLocation getEndLoc() const
SourceLocation getBeginLoc() const
BreakStmt(SourceLocation BL)
const_child_range children() const
static bool classof(const Stmt *T)
void setBreakLoc(SourceLocation L)
BreakStmt(EmptyShell Empty)
Build an empty break statement.
A boolean literal, per ([C++ lex.bool] Boolean literals).
Represents a call to a C++ constructor.
A default argument (C++ [dcl.fct.default]).
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
The null pointer literal (C++11 [lex.nullptr])
A call to an overloaded operator written using operator syntax.
A rewritten comparison expression that was originally written using operator syntax.
An expression "T()" which creates an rvalue of a non-class type T.
Represents the this expression in C++.
A C++ throw-expression (C++ [except.throw]).
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
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.
bool capturesVariableByCopy() const
Determine whether this capture handles a variable by copy.
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.
bool capturesThis() const
Determine whether this capture handles the C++ 'this' pointer.
bool capturesVariable() const
Determine whether this capture handles a variable (by reference).
SourceLocation getLocation() const
Retrieve the source location at which the variable or 'this' was first used.
This captures a statement into a function.
unsigned capture_size() const
Retrieve the number of captures, including 'this'.
const_capture_iterator capture_begin() const
static CapturedStmt * CreateDeserialized(const ASTContext &Context, unsigned NumCaptures)
SourceLocation getEndLoc() const LLVM_READONLY
capture_init_range capture_inits()
void setCapturedRegionKind(CapturedRegionKind Kind)
Set the captured region kind.
const_capture_init_iterator capture_init_begin() const
CapturedDecl * getCapturedDecl()
Retrieve the outlined function declaration.
SourceRange getSourceRange() const LLVM_READONLY
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of captures.
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
Stmt * getCapturedStmt()
Retrieve the statement being captured.
llvm::iterator_range< capture_init_iterator > capture_init_range
llvm::iterator_range< capture_iterator > capture_range
bool capturesVariable(const VarDecl *Var) const
True if this variable has been captured.
static bool classof(const Stmt *T)
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument.
void setCapturedDecl(CapturedDecl *D)
Set the outlined function declaration.
capture_iterator capture_begin()
Retrieve an iterator pointing to the first capture.
llvm::iterator_range< const_capture_init_iterator > const_capture_init_range
const_capture_init_iterator capture_init_end() const
SourceLocation getBeginLoc() const LLVM_READONLY
void setCapturedRecordDecl(RecordDecl *D)
Set the record declaration for captured variables.
llvm::iterator_range< const_capture_iterator > capture_const_range
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument.
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
const Stmt * getCapturedStmt() const
capture_const_range captures() const
CapturedRegionKind getCapturedRegionKind() const
Retrieve the captured region kind.
VariableCaptureKind
The different capture forms: by 'this', by reference, capture for variable-length array type etc.
const_capture_init_range capture_inits() const
CaseStmt - Represent a case statement.
const Expr * getRHS() const
const_child_range children() const
SourceLocation getBeginLoc() const
void setEllipsisLoc(SourceLocation L)
Set the location of the ... in a case statement of the form LHS ... RHS.
static bool classof(const Stmt *T)
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ... RHS, which is a GNU extension.
const Expr * getLHS() const
SourceLocation getEllipsisLoc() const
Get the location of the ... in a case statement of the form LHS ... RHS.
void setCaseLoc(SourceLocation L)
SourceLocation getCaseLoc() const
static CaseStmt * CreateEmpty(const ASTContext &Ctx, bool CaseStmtIsGNURange)
Build an empty case statement.
const Stmt * getSubStmt() const
SourceLocation getEndLoc() const LLVM_READONLY
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Represents a character-granular source range.
Represents a 'co_await' expression.
CompoundStmt - This represents a group of statements like { stmt stmt }.
static bool classof(const Stmt *T)
std::reverse_iterator< const_body_iterator > const_reverse_body_iterator
body_const_range body() const
Stmt *const * const_body_iterator
const_reverse_body_iterator body_rend() const
llvm::iterator_range< const_body_iterator > body_const_range
std::reverse_iterator< body_iterator > reverse_body_iterator
reverse_body_iterator body_rbegin()
llvm::iterator_range< body_iterator > body_range
const Stmt * getStmtExprResult() const
FPOptionsOverride getStoredFPFeatures() const
Get FPOptionsOverride from trailing storage.
const Stmt * body_front() const
SourceLocation getBeginLoc() const
static CompoundStmt * CreateEmpty(const ASTContext &C, unsigned NumStmts, bool HasFPFeatures)
SourceLocation getLBracLoc() const
body_iterator body_begin()
SourceLocation getEndLoc() const
bool hasStoredFPFeatures() const
const_child_range children() const
CompoundStmt(SourceLocation Loc, SourceLocation EndLoc)
reverse_body_iterator body_rend()
CompoundStmt(SourceLocation Loc)
const_body_iterator body_begin() const
Stmt * getStmtExprResult()
const Stmt * body_back() const
const_reverse_body_iterator body_rbegin() const
FPOptionsOverride getStoredFPFeaturesOrDefault() const
Get the store FPOptionsOverride or default if not stored.
SourceLocation getRBracLoc() const
const_body_iterator body_end() const
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
ContinueStmt - This represents a continue.
ContinueStmt(EmptyShell Empty)
Build an empty continue statement.
ContinueStmt(SourceLocation CL)
static bool classof(const Stmt *T)
void setContinueLoc(SourceLocation L)
SourceLocation getContinueLoc() const
SourceLocation getEndLoc() const
const_child_range children() const
SourceLocation getBeginLoc() const
Decl *const * const_iterator
bool isSingleDecl() const
A reference to a declared variable, function, enum, etc.
DeclStmt - Adaptor class for mixing declarations with statements and expressions.
std::reverse_iterator< decl_iterator > reverse_decl_iterator
llvm::iterator_range< decl_iterator > decl_range
const_child_range children() const
SourceLocation getEndLoc() const
const DeclGroupRef getDeclGroup() const
DeclStmt(EmptyShell Empty)
Build an empty declaration statement.
bool isSingleDecl() const
isSingleDecl - This method returns true if this DeclStmt refers to a single Decl.
const_decl_iterator decl_begin() const
void setStartLoc(SourceLocation L)
DeclGroupRef::const_iterator const_decl_iterator
static bool classof(const Stmt *T)
void setEndLoc(SourceLocation L)
decl_iterator decl_begin()
void setDeclGroup(DeclGroupRef DGR)
const Decl * getSingleDecl() const
decl_const_range decls() const
const_decl_iterator decl_end() const
SourceLocation getBeginLoc() const LLVM_READONLY
DeclGroupRef getDeclGroup()
reverse_decl_iterator decl_rend()
llvm::iterator_range< const_decl_iterator > decl_const_range
reverse_decl_iterator decl_rbegin()
DeclStmt(DeclGroupRef dg, SourceLocation startLoc, SourceLocation endLoc)
Decl - This represents one declaration (or definition), e.g.
const Stmt * getSubStmt() const
SourceLocation getEndLoc() const LLVM_READONLY
void setDefaultLoc(SourceLocation L)
SourceLocation getDefaultLoc() const
DefaultStmt(EmptyShell Empty)
Build an empty default statement.
static bool classof(const Stmt *T)
DefaultStmt(SourceLocation DL, SourceLocation CL, Stmt *substmt)
const_child_range children() const
SourceLocation getBeginLoc() const
A qualified reference to a name whose declaration cannot yet be resolved.
Represents a C99 designated initializer expression.
DoStmt - This represents a 'do/while' stmt.
void setWhileLoc(SourceLocation L)
SourceLocation getBeginLoc() const
void setDoLoc(SourceLocation L)
SourceLocation getEndLoc() const
SourceLocation getWhileLoc() const
static bool classof(const Stmt *T)
const_child_range children() const
DoStmt(EmptyShell Empty)
Build an empty do-while statement.
SourceLocation getDoLoc() const
void setRParenLoc(SourceLocation L)
SourceLocation getRParenLoc() const
const Stmt * getBody() const
DoStmt(Stmt *Body, Expr *Cond, SourceLocation DL, SourceLocation WL, SourceLocation RP)
const Expr * getCond() const
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
Represents difference between two FPOptions values.
ForStmt - This represents a 'for (init;cond;inc)' stmt.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "for" statement, if any.
SourceLocation getEndLoc() const
SourceLocation getRParenLoc() const
const_child_range children() const
const DeclStmt * getConditionVariableDeclStmt() const
void setForLoc(SourceLocation L)
const Expr * getInc() const
ForStmt(EmptyShell Empty)
Build an empty for statement.
void setLParenLoc(SourceLocation L)
const Expr * getCond() const
void setConditionVariableDeclStmt(DeclStmt *CondVar)
SourceLocation getBeginLoc() const
static bool classof(const Stmt *T)
const Stmt * getInit() const
void setConditionVariable(const ASTContext &C, VarDecl *V)
SourceLocation getForLoc() const
const Stmt * getBody() const
SourceLocation getLParenLoc() const
DeclStmt * getConditionVariableDeclStmt()
If this ForStmt has a condition variable, return the faux DeclStmt associated with the creation of th...
void setRParenLoc(SourceLocation L)
AsmStringPiece - this is part of a decomposed asm string specification (for use with the AnalyzeAsmSt...
AsmStringPiece(const std::string &S)
const std::string & getString() const
unsigned getOperandNo() const
CharSourceRange getRange() const
AsmStringPiece(unsigned OpNo, const std::string &S, SourceLocation Begin, SourceLocation End)
char getModifier() const
getModifier - Get the modifier for this operand, if present.
This represents a GCC inline-assembly statement extension.
const Expr * getInputExpr(unsigned i) const
const_labels_iterator end_labels() const
StringLiteral * getInputConstraintLiteral(unsigned i)
unsigned getNumLabels() const
const StringLiteral * getInputConstraintLiteral(unsigned i) const
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
const StringLiteral * getClobberStringLiteral(unsigned i) const
SourceLocation getRParenLoc() const
StringRef getClobber(unsigned i) const
labels_const_range labels() const
StringLiteral * getOutputConstraintLiteral(unsigned i)
llvm::iterator_range< labels_iterator > labels_range
labels_iterator begin_labels()
IdentifierInfo * getInputIdentifier(unsigned i) const
labels_iterator end_labels()
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.
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
void setRParenLoc(SourceLocation L)
StringRef getOutputConstraint(unsigned i) const
getOutputConstraint - Return the constraint string for the specified output operand.
void setInputExpr(unsigned i, Expr *E)
const StringLiteral * getAsmString() const
void setAsmString(StringLiteral *E)
static bool classof(const Stmt *T)
StringLiteral * getClobberStringLiteral(unsigned i)
StringRef getInputName(unsigned i) const
SourceLocation getEndLoc() const LLVM_READONLY
StringRef getOutputName(unsigned i) const
const_labels_iterator begin_labels() const
GCCAsmStmt(EmptyShell Empty)
Build an empty inline-assembly statement.
IdentifierInfo * getLabelIdentifier(unsigned i) const
IdentifierInfo * getOutputIdentifier(unsigned i) const
Expr * getOutputExpr(unsigned i)
StringLiteral * getAsmString()
llvm::iterator_range< const_labels_iterator > labels_const_range
int getNamedOperand(StringRef SymbolicName) const
getNamedOperand - Given a symbolic operand reference like %[foo], translate this into a numeric value...
const Expr * getOutputExpr(unsigned i) const
SourceLocation getBeginLoc() const LLVM_READONLY
Expr * getInputExpr(unsigned i)
AddrLabelExpr * getLabelExpr(unsigned i) const
StringRef getInputConstraint(unsigned i) const
getInputConstraint - Return the specified input constraint.
Represents a C11 generic selection.
GotoStmt - This represents a direct goto.
GotoStmt(LabelDecl *label, SourceLocation GL, SourceLocation LL)
SourceLocation getLabelLoc() const
SourceLocation getGotoLoc() const
void setLabel(LabelDecl *D)
GotoStmt(EmptyShell Empty)
Build an empty goto statement.
void setLabelLoc(SourceLocation L)
LabelDecl * getLabel() const
SourceLocation getEndLoc() const
const_child_range children() const
static bool classof(const Stmt *T)
void setGotoLoc(SourceLocation L)
SourceLocation getBeginLoc() const
One of these records is kept for each identifier that is lexed.
IfStmt - This represents an if/then/else.
bool hasElseStorage() const
True if this IfStmt has storage for an else statement.
const Stmt * getElse() const
void setConditionVariableDeclStmt(DeclStmt *CondVar)
void setLParenLoc(SourceLocation Loc)
SourceLocation getIfLoc() const
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.
const DeclStmt * getConditionVariableDeclStmt() const
IfStatementKind getStatementKind() const
SourceLocation getElseLoc() const
bool isNonNegatedConsteval() const
SourceLocation getLParenLoc() const
static bool classof(const Stmt *T)
const Stmt * getThen() const
const Expr * getCond() const
const VarDecl * getConditionVariable() const
void setElseLoc(SourceLocation ElseLoc)
const Stmt * getInit() const
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.
void setStatementKind(IfStatementKind Kind)
std::optional< const Stmt * > getNondiscardedCase(const ASTContext &Ctx) const
If this is an 'if constexpr', determine which substatement will be taken.
bool isObjCAvailabilityCheck() const
bool isNegatedConsteval() const
DeclStmt * getConditionVariableDeclStmt()
If this IfStmt has a condition variable, return the faux DeclStmt associated with the creation of tha...
const_child_range children() const
SourceLocation getRParenLoc() const
void setRParenLoc(SourceLocation Loc)
SourceLocation getBeginLoc() const
SourceLocation getEndLoc() const LLVM_READONLY
void setIfLoc(SourceLocation IfLoc)
VarDecl * getConditionVariable()
Retrieve the variable declared in this "if" statement, if any.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
IndirectGotoStmt - This represents an indirect goto.
SourceLocation getEndLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
LabelDecl * getConstantTarget()
getConstantTarget - Returns the fixed target of this indirect goto, if one exists.
IndirectGotoStmt(SourceLocation gotoLoc, SourceLocation starLoc, Expr *target)
SourceLocation getGotoLoc() const
SourceLocation getBeginLoc() const
void setGotoLoc(SourceLocation L)
const_child_range children() const
const LabelDecl * getConstantTarget() const
void setStarLoc(SourceLocation L)
IndirectGotoStmt(EmptyShell Empty)
Build an empty indirect goto statement.
const Expr * getTarget() const
SourceLocation getStarLoc() const
Describes an C or C++ initializer list.
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
LabelStmt(SourceLocation IL, LabelDecl *D, Stmt *substmt)
Build a label statement.
static bool classof(const Stmt *T)
LabelDecl * getDecl() const
LabelStmt(EmptyShell Empty)
Build an empty label statement.
SourceLocation getIdentLoc() const
void setSubStmt(Stmt *SS)
void setDecl(LabelDecl *D)
SourceLocation getBeginLoc() const
void setIdentLoc(SourceLocation L)
const_child_range children() const
SourceLocation getEndLoc() const LLVM_READONLY
void setSideEntry(bool SE)
const char * getName() const
const Stmt * getSubStmt() const
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
This represents a Microsoft inline-assembly statement extension.
const Expr * getOutputExpr(unsigned i) const
Expr * getOutputExpr(unsigned i)
ArrayRef< StringRef > getClobbers() const
SourceLocation getBeginLoc() const LLVM_READONLY
StringRef getAsmString() const
SourceLocation getLBraceLoc() const
SourceLocation getEndLoc() const
StringRef getInputConstraint(unsigned i) const
void setEndLoc(SourceLocation L)
void setInputExpr(unsigned i, Expr *E)
StringRef getOutputConstraint(unsigned i) const
ArrayRef< StringRef > getAllConstraints() const
static bool classof(const Stmt *T)
StringRef getClobber(unsigned i) const
const Expr * getInputExpr(unsigned i) const
void setLBraceLoc(SourceLocation L)
MSAsmStmt(EmptyShell Empty)
Build an empty MS-style inline-assembly statement.
std::string generateAsmString(const ASTContext &C) const
Assemble final IR asm string.
const_child_range children() const
ArrayRef< Expr * > getAllExprs() const
Expr * getInputExpr(unsigned i)
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
NullStmt - This is the null statement ";": C99 6.8.3p3.
void setSemiLoc(SourceLocation L)
bool hasLeadingEmptyMacro() const
SourceLocation getBeginLoc() const
SourceLocation getSemiLoc() const
static bool classof(const Stmt *T)
NullStmt(SourceLocation L, bool hasLeadingEmptyMacro=false)
NullStmt(EmptyShell Empty)
Build an empty null statement.
const_child_range children() const
SourceLocation getEndLoc() const
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCIndirectCopyRestoreExpr - Represents the passing of a function argument by indirect copy-restore ...
An expression that sends a message to the given Objective-C object or class.
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
ParenExpr - This represents a parenthesized expression, e.g.
[C99 6.4.2.2] - A predefined identifier such as func.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Represents a struct/union/class.
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
void setRetValue(Expr *E)
void setReturnLoc(SourceLocation L)
SourceLocation getReturnLoc() const
static bool classof(const Stmt *T)
SourceLocation getEndLoc() const LLVM_READONLY
void setNRVOCandidate(const VarDecl *Var)
Set the variable that might be used for the named return value optimization.
SourceLocation getBeginLoc() const
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization.
const_child_range children() const
static ReturnStmt * CreateEmpty(const ASTContext &Ctx, bool HasNRVOCandidate)
Create an empty return statement, optionally with storage for an NRVO candidate.
const Expr * getRetValue() const
const_child_range children() const
CompoundStmt * getBlock() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getExceptLoc() const
SourceLocation getEndLoc() const
static bool classof(const Stmt *T)
Expr * getFilterExpr() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getEndLoc() const
const_child_range children() const
SourceLocation getFinallyLoc() const
static bool classof(const Stmt *T)
CompoundStmt * getBlock() const
Represents a __leave statement.
SourceLocation getLeaveLoc() const
SourceLocation getEndLoc() const LLVM_READONLY
SEHLeaveStmt(EmptyShell Empty)
Build an empty __leave statement.
SEHLeaveStmt(SourceLocation LL)
SourceLocation getBeginLoc() const LLVM_READONLY
static bool classof(const Stmt *T)
void setLeaveLoc(SourceLocation L)
const_child_range children() const
const_child_range children() const
CompoundStmt * getTryBlock() const
static bool classof(const Stmt *T)
SourceLocation getTryLoc() const
SEHFinallyStmt * getFinallyHandler() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getEndLoc() const
SEHExceptStmt * getExceptHandler() const
Returns 0 if not defined.
Stmt * getHandler() const
ShuffleVectorExpr - clang-specific builtin-in function __builtin_shufflevector.
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
A trivial tuple used to represent a source range.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
friend class BlockDeclRefExpr
Stmt - This represents one statement.
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.
Stmt(const Stmt &)=delete
UnaryExprOrTypeTraitExprBitfields UnaryExprOrTypeTraitExprBits
CXXUnresolvedConstructExprBitfields CXXUnresolvedConstructExprBits
WhileStmtBitfields WhileStmtBits
SwitchCaseBitfields SwitchCaseBits
GenericSelectionExprBitfields GenericSelectionExprBits
InitListExprBitfields InitListExprBits
static void EnableStatistics()
LambdaExprBitfields LambdaExprBits
AttributedStmtBitfields AttributedStmtBits
ParenListExprBitfields ParenListExprBits
ArrayOrMatrixSubscriptExprBitfields ArrayOrMatrixSubscriptExprBits
UnresolvedLookupExprBitfields UnresolvedLookupExprBits
SwitchStmtBitfields SwitchStmtBits
SubstNonTypeTemplateParmExprBitfields SubstNonTypeTemplateParmExprBits
CXXNoexceptExprBitfields CXXNoexceptExprBits
ParenExprBitfields ParenExprBits
StmtIterator child_iterator
Child Iterators: All subclasses must implement 'children' to permit easy iteration over the substatem...
CXXRewrittenBinaryOperatorBitfields CXXRewrittenBinaryOperatorBits
ContinueStmtBitfields ContinueStmtBits
CallExprBitfields CallExprBits
Stmt * stripLabelLikeStatements()
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
const Stmt * stripLabelLikeStatements() const
Strip off all label-like statements.
ExprWithCleanupsBitfields ExprWithCleanupsBits
FloatingLiteralBitfields FloatingLiteralBits
const_child_range children() const
child_iterator child_begin()
void printJson(raw_ostream &Out, PrinterHelper *Helper, const PrintingPolicy &Policy, bool AddQuotes) const
Pretty-prints in JSON format.
StmtClass getStmtClass() const
CXXScalarValueInitExprBitfields CXXScalarValueInitExprBits
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
CharacterLiteralBitfields CharacterLiteralBits
OverloadExprBitfields OverloadExprBits
CXXConstructExprBitfields CXXConstructExprBits
void printPrettyControlled(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
UnaryOperatorBitfields UnaryOperatorBits
static std::tuple< bool, const Attr *, const Attr * > determineLikelihoodConflict(const Stmt *Then, const Stmt *Else)
CXXDependentScopeMemberExprBitfields CXXDependentScopeMemberExprBits
GotoStmtBitfields GotoStmtBits
child_iterator child_end()
ConstCastIterator< Expr > ConstExprIterator
TypeTraitExprBitfields TypeTraitExprBits
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const
Produce a unique representation of the given statement.
CXXNewExprBitfields CXXNewExprBits
SourceLocExprBitfields SourceLocExprBits
CXXNullPtrLiteralExprBitfields CXXNullPtrLiteralExprBits
CoawaitExprBitfields CoawaitBits
Stmt(StmtClass SC, EmptyShell)
Construct an empty statement.
ConstantExprBitfields ConstantExprBits
llvm::iterator_range< child_iterator > child_range
void dump() const
Dumps the specified AST fragment and all subtrees to llvm::errs().
CompoundStmtBitfields CompoundStmtBits
RequiresExprBitfields RequiresExprBits
StmtExprBitfields StmtExprBits
StringLiteralBitfields StringLiteralBits
OpaqueValueExprBitfields OpaqueValueExprBits
CastExprBitfields CastExprBits
Likelihood
The likelihood of a branch being taken.
@ LH_Unlikely
Branch has the [[unlikely]] attribute.
@ LH_None
No attribute set or branches of the IfStmt have the same attribute.
@ LH_Likely
Branch has the [[likely]] attribute.
CXXThrowExprBitfields CXXThrowExprBits
static void addStmtClass(const StmtClass s)
MemberExprBitfields MemberExprBits
ForStmtBitfields ForStmtBits
DeclRefExprBitfields DeclRefExprBits
const_child_iterator child_end() const
const char * getStmtClassName() const
ConstStmtIterator const_child_iterator
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
CXXOperatorCallExprBitfields CXXOperatorCallExprBits
CXXDefaultInitExprBitfields CXXDefaultInitExprBits
Stmt & operator=(const Stmt &)=delete
NullStmtBitfields NullStmtBits
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
IfStmtBitfields IfStmtBits
Stmt & operator=(Stmt &&)=delete
PredefinedExprBitfields PredefinedExprBits
int64_t getID(const ASTContext &Context) const
ReturnStmtBitfields ReturnStmtBits
LabelStmtBitfields LabelStmtBits
ObjCIndirectCopyRestoreExprBitfields ObjCIndirectCopyRestoreExprBits
SourceLocation getBeginLoc() const LLVM_READONLY
void dumpColor() const
dumpColor - same as dump(), but forces color highlighting.
BinaryOperatorBitfields BinaryOperatorBits
UnresolvedMemberExprBitfields UnresolvedMemberExprBits
PseudoObjectExprBitfields PseudoObjectExprBits
BreakStmtBitfields BreakStmtBits
void viewAST() const
viewAST - Visualize an AST rooted at this Stmt* using GraphViz.
llvm::iterator_range< const_child_iterator > const_child_range
const_child_iterator child_begin() const
CXXDeleteExprBitfields CXXDeleteExprBits
CXXDefaultArgExprBitfields CXXDefaultArgExprBits
DoStmtBitfields DoStmtBits
CXXThisExprBitfields CXXThisExprBits
CastIterator< Expr > ExprIterator
static Likelihood getLikelihood(ArrayRef< const Attr * > Attrs)
StringLiteral - This represents a string literal expression, e.g.
Represents a reference to a non-type template parameter that has been substituted with a template arg...
SwitchCase * NextSwitchCase
A pointer to the following CaseStmt or DefaultStmt class, used by SwitchStmt.
void setColonLoc(SourceLocation L)
static bool classof(const Stmt *T)
SwitchCase(StmtClass SC, EmptyShell)
SourceLocation getKeywordLoc() const
SwitchCase(StmtClass SC, SourceLocation KWLoc, SourceLocation ColonLoc)
void setKeywordLoc(SourceLocation L)
const Stmt * getSubStmt() const
void setNextSwitchCase(SwitchCase *SC)
SourceLocation getColonLoc() const
SourceLocation getBeginLoc() const
const SwitchCase * getNextSwitchCase() const
SourceLocation ColonLoc
The location of the ":".
SourceLocation getEndLoc() const LLVM_READONLY
SwitchCase * getNextSwitchCase()
SwitchStmt - This represents a 'switch' stmt.
const Stmt * getInit() const
SourceLocation getSwitchLoc() const
void addSwitchCase(SwitchCase *SC)
void setBody(Stmt *S, SourceLocation SL)
SourceLocation getLParenLoc() const
const Expr * getCond() const
bool isAllEnumCasesCovered() const
Returns true if the SwitchStmt is a switch of an enum value and all cases have been explicitly covere...
void setSwitchLoc(SourceLocation L)
void setConditionVariableDeclStmt(DeclStmt *CondVar)
void setRParenLoc(SourceLocation Loc)
SourceLocation getEndLoc() const LLVM_READONLY
SourceLocation getRParenLoc() const
void setConditionVariable(const ASTContext &Ctx, VarDecl *VD)
Set the condition variable in this switch statement.
void setLParenLoc(SourceLocation Loc)
const Stmt * getBody() const
const VarDecl * getConditionVariable() const
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
bool hasVarStorage() const
True if this SwitchStmt has storage for a condition variable.
const_child_range children() const
VarDecl * getConditionVariable()
Retrieve the variable declared in this "switch" statement, if any.
SourceLocation getBeginLoc() const
bool hasInitStorage() const
True if this SwitchStmt has storage for an init statement.
SwitchCase * getSwitchCaseList()
const SwitchCase * getSwitchCaseList() const
DeclStmt * getConditionVariableDeclStmt()
If this SwitchStmt has a condition variable, return the faux DeclStmt associated with the creation of...
void setAllEnumCasesCovered()
Set a flag in the SwitchStmt indicating that if the 'switch (X)' is a switch over an enum value then ...
void setSwitchCaseList(SwitchCase *SC)
static bool classof(const Stmt *T)
Token - This structure provides full information about a lexed token.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Represents a statement that could possibly have a value and type.
const Expr * getExprStmt() const
static bool classof(const Stmt *T)
Represents a variable declaration or definition.
WhileStmt - This represents a 'while' stmt.
SourceLocation getWhileLoc() const
SourceLocation getRParenLoc() const
DeclStmt * getConditionVariableDeclStmt()
If this WhileStmt has a condition variable, return the faux DeclStmt associated with the creation of ...
void setLParenLoc(SourceLocation L)
VarDecl * getConditionVariable()
Retrieve the variable declared in this "while" statement, if any.
SourceLocation getEndLoc() const LLVM_READONLY
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.
SourceLocation getLParenLoc() const
SourceLocation getBeginLoc() const
const Stmt * getBody() const
void setRParenLoc(SourceLocation L)
const VarDecl * getConditionVariable() const
void setWhileLoc(SourceLocation L)
const Expr * getCond() const
static WhileStmt * CreateEmpty(const ASTContext &Ctx, bool HasVar)
Create an empty while statement optionally with storage for a condition variable.
const DeclStmt * getConditionVariableDeclStmt() const
void setConditionVariableDeclStmt(DeclStmt *CondVar)
static bool classof(const Stmt *T)
const_child_range children() const
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
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.
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',...
CapturedRegionKind
The different kinds of captured statement.
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
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.
const FunctionProtoType * T
TypeTrait
Names for traits that operate specifically on types.
CXXNewInitializationStyle
NonOdrUseReason
The reason why a DeclRefExpr does not constitute an odr-use.
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 *.
Base::value_type operator*() const
A placeholder type used to construct an empty shell of a type, that will be filled in later (e....