clang: include/clang/Sema/DeclSpec.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22#ifndef LLVM_CLANG_SEMA_DECLSPEC_H
23#define LLVM_CLANG_SEMA_DECLSPEC_H
24
35#include "llvm/ADT/STLExtras.h"
36#include "llvm/ADT/SmallVector.h"
37#include "llvm/Support/Compiler.h"
38#include "llvm/Support/ErrorHandling.h"
39#include
40
42 class ASTContext;
43 class CXXRecordDecl;
44 class TypeLoc;
45 class LangOptions;
46 class IdentifierInfo;
47 class NamespaceAliasDecl;
48 class NamespaceDecl;
49 class ObjCDeclSpec;
50 class Sema;
52 struct TemplateIdAnnotation;
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
78
79public:
86
88 TemplateParamLists = L;
89 }
91 return TemplateParamLists;
92 }
93
94
96 return Builder.getRepresentation();
97 }
98
99
100
101
102
103
104
105
106
107
108
109
112
113
114
115
116
117
118
119
120
121
122
123
126
127
128
129
130
131
132
133
134
135
136
137
140
141
142
143
144
145
146
147
148
149
150
151
152
155
156
157
159
160
161
162
163
164
165
166
167
168
169
170
171
172
175
176
177
178
179
180
181
184
185
186
188
189
190
191
192
193
195
196
197
198
199
200
201
202
203
204
206
207
209
211
212
214
216
217
219 assert(R.isValid() && "Must have a valid source range");
220 if (Range.getBegin().isInvalid())
223 Builder.Clear();
224 }
225
226
227
229
232 Builder.Clear();
233 }
234
235
236 char *location_data() const { return Builder.getBuffer().first; }
237
238
239
240 unsigned location_size() const { return Builder.getBuffer().second; }
241};
242
243
244
245
246
248public:
249
250
261
262
263
269
275
276
315#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) \
316 static const TST TST_##Trait = clang::TST_##Trait;
317#include "clang/Basic/TransformTypeTraits.def"
322#define GENERIC_IMAGE_TYPE(ImgType, Id) \
323 static const TST TST_##ImgType##_t = clang::TST_##ImgType##_t;
324#include "clang/Basic/OpenCLImageTypes.def"
325#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
326 static const TST TST_##Name = clang::TST_##Name;
327#include "clang/Basic/HLSLIntangibleTypes.def"
329
330
337
338
341
342
343
350
352
354
355private:
356
357 LLVM_PREFERRED_TYPE(SCS)
358 unsigned StorageClassSpec : 3;
359 LLVM_PREFERRED_TYPE(TSCS)
360 unsigned ThreadStorageClassSpec : 2;
361 LLVM_PREFERRED_TYPE(bool)
362 unsigned SCS_extern_in_linkage_spec : 1;
363
364
366 unsigned TypeSpecWidth : 2;
367 LLVM_PREFERRED_TYPE(TSC)
368 unsigned TypeSpecComplex : 2;
370 unsigned TypeSpecSign : 2;
371 LLVM_PREFERRED_TYPE(TST)
372 unsigned TypeSpecType : 7;
373 LLVM_PREFERRED_TYPE(bool)
374 unsigned TypeAltiVecVector : 1;
375 LLVM_PREFERRED_TYPE(bool)
376 unsigned TypeAltiVecPixel : 1;
377 LLVM_PREFERRED_TYPE(bool)
378 unsigned TypeAltiVecBool : 1;
379 LLVM_PREFERRED_TYPE(bool)
380 unsigned TypeSpecOwned : 1;
381 LLVM_PREFERRED_TYPE(bool)
382 unsigned TypeSpecPipe : 1;
383 LLVM_PREFERRED_TYPE(bool)
384 unsigned TypeSpecSat : 1;
385 LLVM_PREFERRED_TYPE(bool)
386 unsigned ConstrainedAuto : 1;
387
388
389 LLVM_PREFERRED_TYPE(TQ)
390 unsigned TypeQualifiers : 5;
391
392
393 LLVM_PREFERRED_TYPE(bool)
394 unsigned FS_inline_specified : 1;
395 LLVM_PREFERRED_TYPE(bool)
396 unsigned FS_forceinline_specified: 1;
397 LLVM_PREFERRED_TYPE(bool)
398 unsigned FS_virtual_specified : 1;
399 LLVM_PREFERRED_TYPE(bool)
400 unsigned FS_noreturn_specified : 1;
401
402
403 LLVM_PREFERRED_TYPE(bool)
404 unsigned FriendSpecifiedFirst : 1;
405
406
408 unsigned ConstexprSpecifier : 2;
409
410 union {
415 };
417
418
420
421
423
424
426
427
428
430
431 SourceLocation StorageClassSpecLoc, ThreadStorageClassSpecLoc;
433 SourceLocation TSCLoc, TSSLoc, TSTLoc, AltiVecLoc, TSSatLoc, EllipsisLoc;
434
435
436
437
440 SourceLocation TQ_constLoc, TQ_restrictLoc, TQ_volatileLoc, TQ_atomicLoc,
441 TQ_unalignedLoc;
442 SourceLocation FS_inlineLoc, FS_virtualLoc, FS_explicitLoc, FS_noreturnLoc;
445 SourceLocation FriendLoc, ModulePrivateLoc, ConstexprLoc;
447
449 void SaveWrittenBuiltinSpecs();
450
452
457 }
458 static bool isExprRep(TST T) {
461 }
462 static bool isTemplateIdRep(TST T) {
464 }
465
466 DeclSpec(const DeclSpec &) = delete;
467 void operator=(const DeclSpec &) = delete;
468public:
473 }
475 constexpr std::array<TST, 16> Traits = {
476#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait) TST_##Trait,
477#include "clang/Basic/TransformTypeTraits.def"
478 };
479
480 return T >= Traits.front() && T <= Traits.back();
481 }
482
486 SCS_extern_in_linkage_spec(false),
491 TypeAltiVecPixel(false), TypeAltiVecBool(false), TypeSpecOwned(false),
492 TypeSpecPipe(false), TypeSpecSat(false), ConstrainedAuto(false),
494 FS_forceinline_specified(false), FS_virtual_specified(false),
495 FS_noreturn_specified(false), FriendSpecifiedFirst(false),
496 ConstexprSpecifier(
498 Attrs(attrFactory), writtenBS(), ObjCQualifiers(nullptr) {}
499
500
503 return (TSCS)ThreadStorageClassSpec;
504 }
507 SCS_extern_in_linkage_spec = Value;
508 }
509
512 return ThreadStorageClassSpecLoc;
513 }
514
518 SCS_extern_in_linkage_spec = false;
521 }
522
525 TypeSpecOwned = false;
527 }
528
529
532 }
536 }
546
548 assert(isTypeRep((TST) TypeSpecType) && "DeclSpec does not store a type");
550 }
552 assert(isDeclRep((TST) TypeSpecType) && "DeclSpec does not store a decl");
554 }
556 assert(isExprRep((TST) TypeSpecType) && "DeclSpec does not store an expr");
558 }
559
562 "DeclSpec is not a pack indexing expr");
564 }
565
567 assert(isTemplateIdRep((TST) TypeSpecType) &&
568 "DeclSpec does not store a template id");
570 }
573
577
585
588 isExprRep((TST)TypeSpecType));
589 return TSTNameLoc;
590 }
591
594
598 }
599
601
602
612
613
614
615
624
625
627 TypeQualifiers = 0;
634 }
635
636
638 return FS_inline_specified | FS_forceinline_specified;
639 }
641 return FS_inline_specified ? FS_inlineLoc : FS_forceinlineLoc;
642 }
643
645 return FS_explicit_specifier;
646 }
647
650
652 return FS_explicit_specifier.isSpecified();
653 }
656 return FS_explicit_specifier.getExpr()
657 ? SourceRange(FS_explicitLoc, FS_explicitCloseParenLoc)
659 }
660
663
665 FS_inline_specified = false;
667 FS_forceinline_specified = false;
669 FS_virtual_specified = false;
674 FS_noreturn_specified = false;
676 }
677
678
679
680
682 llvm::function_ref<void(TQ, StringRef, SourceLocation)> Handle);
683
684
685
686
688 llvm::function_ref<void(TQ, StringRef, SourceLocation)> Handle);
689
690
696 }
697
698
699
701
702
703
706 }
707
710
711
712
713
714
715
716
717
718
719
720
722 const char *&PrevSpec, unsigned &DiagID,
725 const char *&PrevSpec, unsigned &DiagID);
727 const char *&PrevSpec, unsigned &DiagID,
730 unsigned &DiagID);
732 const char *&PrevSpec, unsigned &DiagID);
744 }
746 unsigned &DiagID, Decl *Rep, bool Owned,
754 unsigned &DiagID, Decl *Rep, bool Owned,
759
761 unsigned &DiagID, Expr *Rep,
764 const char *&PrevSpec, unsigned &DiagID,
767 const char *&PrevSpec, unsigned &DiagID,
770 const char *&PrevSpec, unsigned &DiagID,
773 const char *&PrevSpec, unsigned &DiagID,
776 const char *&PrevSpec, unsigned &DiagID,
779 unsigned &DiagID);
780
782
787 }
791 }
793 assert(isExprRep((TST) TypeSpecType));
795 }
796
798
800 unsigned &DiagID, const LangOptions &Lang);
801
803 unsigned &DiagID);
805 unsigned &DiagID);
807 unsigned &DiagID);
812 unsigned &DiagID);
813
815 unsigned &DiagID);
817 unsigned &DiagID);
819 const char *&PrevSpec, unsigned &DiagID);
820
823 }
824
826
828
831
834 }
835
839 }
840
844 }
845
848 }
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
869 }
870
872
875
878 }
879
880
881
882
884
886 return writtenBS;
887 }
888
891
892
893
894
896};
897
898
899
901public:
902
903
904
905
906
907
918
920 : objcDeclQualifier(DQ_None),
921 PropertyAttributes(ObjCPropertyAttribute::kind_noattr), Nullability(0),
922 GetterName(nullptr), SetterName(nullptr) {}
923
926 }
928 objcDeclQualifier = (ObjCDeclQualifier) (objcDeclQualifier | DQVal);
929 }
931 objcDeclQualifier = (ObjCDeclQualifier) (objcDeclQualifier & ~DQVal);
932 }
933
936 }
938 PropertyAttributes =
940 }
941
943 assert(
946 "Objective-C declspec doesn't have nullability");
948 }
949
951 assert(
954 "Objective-C declspec doesn't have nullability");
955 return NullabilityLoc;
956 }
957
959 assert(
962 "Set the nullability declspec or property attribute first");
963 Nullability = static_cast<unsigned>(kind);
964 NullabilityLoc = loc;
965 }
966
971 GetterName = name;
972 GetterNameLoc = loc;
973 }
974
979 SetterName = name;
980 SetterNameLoc = loc;
981 }
982
983private:
984
985
986
987 unsigned objcDeclQualifier : 7;
988
989
991
992 unsigned Nullability : 2;
993
995
996 IdentifierInfo *GetterName;
997 IdentifierInfo *SetterName;
998 SourceLocation GetterNameLoc;
999 SourceLocation SetterNameLoc;
1000
1001};
1002
1003
1005
1007
1009
1011
1013
1015
1017
1019
1021
1023
1025};
1026
1027
1029private:
1032
1033
1035
1036public:
1038
1040
1041
1042
1043
1044
1045
1046
1047
1049 };
1050
1051
1052
1053 union {
1054
1055
1057
1058
1059
1061
1062
1063
1065
1066
1067
1069
1070
1071
1073
1074
1076
1077
1078
1079
1081 };
1082
1083
1084
1085
1087
1088
1090
1093
1094
1095
1101 }
1102
1103
1105
1106
1108
1109
1111
1112
1113
1114
1115
1120 }
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1134
1135
1136
1137
1138
1139
1140
1141
1142
1150 }
1151
1152
1153
1154
1155
1156
1157
1158
1159
1166 }
1167
1168
1169
1170
1171
1172
1173
1174
1182 }
1183
1184
1185
1186
1187
1188
1189
1191
1192
1193
1194
1195
1196
1197
1205 }
1206
1207
1208
1209
1210
1211
1213
1214
1215
1216
1217
1218
1224 }
1225
1226
1227
1228
1229
1234 }
1235
1236
1239 }
1242};
1243
1244
1246
1247
1248
1249
1250
1253
1254 enum {
1257
1258
1260
1262
1267 }
1268
1270
1272
1275
1276
1278
1279
1281
1282
1284
1285
1287
1288
1290
1292 }
1293 };
1294
1296
1298
1301 }
1302 };
1303
1305
1306
1309
1310
1311 LLVM_PREFERRED_TYPE(bool)
1313
1314
1315 LLVM_PREFERRED_TYPE(bool)
1317
1318
1319
1320
1322
1324 };
1325
1326
1327
1328
1329
1330
1331
1332
1337
1338
1339
1340
1341
1342
1344
1347 std::unique_ptr DefArgTokens = nullptr)
1350 };
1351
1355 };
1356
1358
1359
1360
1361 LLVM_PREFERRED_TYPE(bool)
1363
1364
1365
1366
1367 LLVM_PREFERRED_TYPE(bool)
1369
1370
1371 LLVM_PREFERRED_TYPE(bool)
1373
1374
1375
1376 LLVM_PREFERRED_TYPE(bool)
1378
1379
1382
1383
1384 LLVM_PREFERRED_TYPE(bool)
1386
1387
1388
1389 LLVM_PREFERRED_TYPE(bool)
1391
1392
1394
1395
1397
1398
1400
1401
1402
1404
1405
1406
1407
1409
1410
1411
1412
1414
1415
1416
1418
1419
1421
1422
1424
1425
1426
1427
1429
1430
1432
1433
1435
1436 union {
1437
1438
1439
1441
1442
1443
1445
1446
1447
1449
1450
1451
1452
1454 };
1455
1456
1457
1459
1460
1461
1463
1464
1465
1466
1468 for (unsigned I = 0; I < NumParams; ++I)
1469 Params[I].DefaultArgTokens.reset();
1473 }
1475 }
1476
1482 default:
1483 break;
1486 break;
1489 break;
1493 break;
1494 }
1495 }
1496
1501 }
1503 }
1504
1505
1506
1507
1509
1511
1513
1515
1518 }
1519
1522 }
1523
1526 }
1527
1528
1530
1531
1535 }
1536
1537
1541 }
1542
1543
1547 }
1548
1549
1551
1552
1553
1555
1556
1557
1559
1560
1564 }
1565
1566
1569 }
1570
1571
1575 }
1576
1577
1578
1582 }
1583
1584
1585
1587
1588
1592 }
1593
1594
1598 }
1599 };
1600
1602
1603
1606
1608 }
1609 };
1610
1612
1615
1617
1618
1622 }
1625 }
1627 Scope().~CXXScopeSpec();
1628 }
1629 };
1630
1632
1634
1636 };
1637
1638 union {
1646 };
1647
1649 switch (Kind) {
1658 }
1659 }
1660
1661
1662
1665
1666
1683 return I;
1684 }
1685
1686
1688 bool lvalue) {
1694 return I;
1695 }
1696
1697
1699 bool isStatic, bool isStar, Expr *NumElts,
1703 I.Loc = LBLoc;
1709 return I;
1710 }
1711
1712
1713
1715 bool IsAmbiguous,
1717 ParamInfo *Params, unsigned NumParams,
1720 bool RefQualifierIsLvalueRef,
1727 unsigned NumExceptions,
1728 Expr *NoexceptExpr,
1738 DeclSpec *MethodQualifiers = nullptr);
1739
1740
1747 return I;
1748 }
1749
1750
1757 return I;
1758 }
1759
1761 unsigned TypeQuals,
1772 return I;
1773 }
1774
1775
1780 I.Loc = LParenLoc;
1781 I.EndLoc = RParenLoc;
1782 return I;
1783 }
1784
1787 }
1788};
1789
1790
1791
1793public:
1798 };
1799
1800private:
1801
1803
1804
1806 unsigned NumBindings : 31;
1807 LLVM_PREFERRED_TYPE(bool)
1808 unsigned DeleteBindings : 1;
1809
1811
1812public:
1814 : Bindings(nullptr), NumBindings(0), DeleteBindings(false) {}
1818
1821 if (DeleteBindings)
1823 else
1827 NumBindings = 0;
1828 DeleteBindings = false;
1829 }
1830
1833 }
1834
1836
1840 return SourceRange(LSquareLoc, RSquareLoc);
1841 }
1842};
1843
1844
1845
1851};
1852
1854 File,
1855 Prototype,
1856 ObjCResult,
1857 ObjCParameter,
1858 KNRTypeList,
1859 TypeName,
1860 FunctionalCast,
1861 Member,
1862 Block,
1863 ForInit,
1864 SelectionInit,
1865 Condition,
1866 TemplateParam,
1867 CXXNew,
1868 CXXCatch,
1869 ObjCCatch,
1871 LambdaExpr,
1875 TrailingReturnVar,
1876 TemplateArg,
1877 TemplateTypeArg,
1878 AliasDecl,
1879 AliasTemplate,
1881 Association
1882};
1883
1884
1885
1889};
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1904
1905private:
1910
1911
1913
1914
1916
1917
1918
1919
1920
1922
1923
1924 LLVM_PREFERRED_TYPE(bool)
1925 unsigned InvalidType : 1;
1926
1927
1928 LLVM_PREFERRED_TYPE(bool)
1929 unsigned GroupingParens : 1;
1930
1931
1932
1933
1934
1936 unsigned FunctionDefinition : 2;
1937
1938
1939 LLVM_PREFERRED_TYPE(bool)
1940 unsigned Redeclaration : 1;
1941
1942
1943 LLVM_PREFERRED_TYPE(bool)
1944 unsigned Extension : 1;
1945
1946
1947 LLVM_PREFERRED_TYPE(bool)
1948 unsigned ObjCIvar : 1;
1949
1950
1951 LLVM_PREFERRED_TYPE(bool)
1952 unsigned ObjCWeakProperty : 1;
1953
1954
1955 LLVM_PREFERRED_TYPE(bool)
1956 unsigned InlineStorageUsed : 1;
1957
1958
1959 LLVM_PREFERRED_TYPE(bool)
1960 unsigned HasInitializer : 1;
1961
1962
1964
1965
1966
1968
1969
1970 Expr *AsmLabel;
1971
1972
1973
1974 Expr *TrailingRequiresClause;
1975
1976
1978
1979
1980
1981
1983
1984#ifndef _MSC_VER
1985 union {
1986#endif
1987
1988
1989
1992#ifndef _MSC_VER
1993 };
1994#endif
1995
1996
1997
1999
2000
2001
2003
2005
2007
2008public:
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2029 GroupingParens(false), FunctionDefinition(static_cast<unsigned>(
2031 Redeclaration(false), Extension(false), ObjCIvar(false),
2032 ObjCWeakProperty(false), InlineStorageUsed(false),
2034 DeclarationAttrs(DeclarationAttrs), AsmLabel(nullptr),
2035 TrailingRequiresClause(nullptr),
2036 InventedTemplateParameterList(nullptr) {
2037 assert(llvm::all_of(DeclarationAttrs,
2041 }) &&
2042 "DeclarationAttrs may only contain [[]] and keyword attributes");
2043 }
2044
2047 }
2048
2049
2051
2052
2053
2054
2055
2056
2058
2061 }
2062
2063
2064
2067
2068
2070
2072 return BindingGroup;
2073 }
2074
2076
2082 }
2083
2084
2088
2090
2091
2093 if (.isInvalid())
2095 }
2096
2098 if (.isInvalid())
2100 }
2101
2102
2103
2106 if (Range.getBegin().isInvalid())
2110 }
2111
2112
2115 Name.clear();
2117 BindingGroup.clear();
2118
2119 for (unsigned i = 0, e = DeclTypeInfo.size(); i != e; ++i)
2120 DeclTypeInfo[i].destroy();
2121 DeclTypeInfo.clear();
2123 AsmLabel = nullptr;
2124 InlineStorageUsed = false;
2125 HasInitializer = false;
2126 ObjCIvar = false;
2127 ObjCWeakProperty = false;
2131 }
2132
2133
2134
2135
2137 switch (Context) {
2145 return false;
2146
2168 return true;
2169 }
2170 llvm_unreachable("unknown context kind!");
2171 }
2172
2173
2174
2175
2177 switch (Context) {
2191 return true;
2192
2208 return false;
2209 }
2210 llvm_unreachable("unknown context kind!");
2211 }
2212
2213
2215 switch (Context) {
2217
2218
2223 return true;
2224
2229
2230 return false;
2231
2232
2252 return false;
2253 }
2254 llvm_unreachable("unknown context kind!");
2255 }
2256
2257
2258
2261
2263 return false;
2264
2267 return false;
2268
2269
2271 return false;
2272
2273 switch (Context) {
2279 return true;
2280
2282
2283
2284
2285 return true;
2286
2309 return false;
2310 }
2311 llvm_unreachable("unknown context kind!");
2312 }
2313
2314
2315
2316
2318
2319
2320
2321
2322
2326 }
2327
2328
2330 return BindingGroup.isSet();
2331 }
2332
2335 return Name.Identifier;
2336
2337 return nullptr;
2338 }
2340
2341
2343 Name.setIdentifier(Id, IdLoc);
2344 }
2345
2346
2351
2352
2353
2354
2355
2358 DeclTypeInfo.push_back(TI);
2359 DeclTypeInfo.back().getAttrs().addAll(attrs.begin(), attrs.end());
2361
2364 }
2365
2366
2367
2368
2369
2372 DeclTypeInfo.push_back(TI);
2374
2377 }
2378
2379
2380
2382 DeclTypeInfo.push_back(TI);
2383
2385 "Cannot add a declarator chunk with attributes with this overload");
2386
2389 }
2390
2391
2393 DeclTypeInfo.insert(DeclTypeInfo.begin(), TI);
2394 }
2395
2396
2398
2399
2400
2402 assert(i < DeclTypeInfo.size() && "Invalid type chunk");
2403 return DeclTypeInfo[i];
2404 }
2406 assert(i < DeclTypeInfo.size() && "Invalid type chunk");
2407 return DeclTypeInfo[i];
2408 }
2409
2412
2413
2415 return type_object_range(DeclTypeInfo.begin(), DeclTypeInfo.end());
2416 }
2417
2419 assert(!DeclTypeInfo.empty() && "No type chunks to drop.");
2420 DeclTypeInfo.front().destroy();
2421 DeclTypeInfo.erase(DeclTypeInfo.begin());
2422 }
2423
2424
2425
2426
2428 for (unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2429 if (!DeclTypeInfo[i].isParen())
2430 return &DeclTypeInfo[i];
2431 }
2432 return nullptr;
2433 }
2434
2435
2436
2437
2439 for (unsigned i = DeclTypeInfo.size(), i_end = 0; i != i_end; --i) {
2440 if (!DeclTypeInfo[i-1].isParen())
2441 return &DeclTypeInfo[i-1];
2442 }
2443 return nullptr;
2444 }
2445
2446
2447
2448
2453 }
2454
2455
2456
2457
2458
2460 for (unsigned i = 0, i_end = DeclTypeInfo.size(); i < i_end; ++i) {
2461 switch (DeclTypeInfo[i].Kind) {
2463 idx = i;
2464 return true;
2466 continue;
2473 return false;
2474 }
2475 llvm_unreachable("Invalid type chunk");
2476 }
2477 return false;
2478 }
2479
2480
2481
2482
2484 unsigned index;
2486 }
2487
2488
2489
2492 unsigned index = 0;
2494 return DeclTypeInfo[index].Fun;
2495 }
2496
2497
2498
2501 }
2502
2503
2504
2505
2506
2507
2508
2510
2511
2512
2515 return false;
2516
2517 switch (Context) {
2523 return true;
2524
2548 return false;
2549 }
2550 llvm_unreachable("unknown context kind!");
2551 }
2552
2553
2554
2556 switch (Context) {
2560
2561
2563
2583 return false;
2584
2590 return true;
2591 }
2592
2593 llvm_unreachable("unknown context kind!");
2594 }
2595
2596
2597
2600 return false;
2601
2604 return false;
2605
2606 return true;
2607 }
2608
2609
2610
2614 Chunk.Fun.hasTrailingReturnType())
2615 return true;
2616 return false;
2617 }
2618
2619
2623 Chunk.Fun.hasTrailingReturnType())
2624 return Chunk.Fun.getTrailingReturnType();
2626 }
2627
2628
2630 TrailingRequiresClause = TRC;
2631
2633 }
2634
2635
2637 return TrailingRequiresClause;
2638 }
2639
2640
2641
2643 return TrailingRequiresClause != nullptr;
2644 }
2645
2646
2648 TemplateParameterLists = TPLs;
2649 }
2650
2651
2653 return TemplateParameterLists;
2654 }
2655
2656
2657
2658
2660 InventedTemplateParameterList = Invented;
2661 }
2662
2663
2664
2665
2667 return InventedTemplateParameterList;
2668 }
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2681
2684 }
2685
2688
2690 return DeclarationAttrs;
2691 }
2692
2693
2697 return true;
2700 return true;
2701 return false;
2702 }
2703
2706
2709
2712
2715
2719 }
2720
2723
2727
2731
2735
2737 FunctionDefinition = static_cast<unsigned>(Val);
2738 }
2739
2742 }
2743
2746 }
2747
2750
2751
2755 }
2756
2757
2758
2759
2761
2763
2764
2766
2769};
2770
2771
2772
2780};
2781
2782
2784public:
2790
2794
2796
2798 const char *&PrevSpec);
2799
2800 bool isUnset() const { return Specifiers == 0; }
2801
2804
2809
2810 void clear() { Specifiers = 0; }
2811
2813
2817
2818private:
2819 unsigned Specifiers = 0;
2821
2822 SourceLocation VS_overrideLoc, VS_finalLoc, VS_abstractLoc;
2825};
2826
2829 CopyInit,
2832};
2833
2834
2836
2846
2855 };
2856
2861
2863
2866 }
2867
2868
2878 InitCaptureType, ExplicitRange));
2879 }
2880};
2881
2883
2884
2885
2887
2888
2889
2891
2892
2893
2894
2895
2896
2897
2898
2900};
2901
2902}
2903
2904#endif
enum clang::sema::@1727::IndirectLocalPathEntry::EntryKind Kind
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the ExceptionSpecificationType enumeration and various utility functions.
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
Defines an enumeration for C++ overloaded operators.
llvm::SmallVector< std::pair< const MemRegion *, SVal >, 4 > Bindings
Defines various enumerations that describe declaration and type specifiers.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
The result of parsing/analyzing an expression, statement etc.
bool isRegularKeywordAttribute() const
bool isStandardAttributeSyntax() const
The attribute is spelled [[]] in either C or C++ mode, including standard attributes spelled with a k...
A factory, from which one makes pools, from which one creates individual attributes which are dealloc...
void takeFrom(ParsedAttributesView &List, AttributePool &Pool)
Removes the attributes from List, which are owned by Pool, and adds them at the end of this Attribute...
void takeAllFrom(AttributePool &pool)
Take the given pool's allocations and add them to this pool.
Represents a C++ struct/union/class.
Represents a C++ nested-name-specifier or a global scope specifier.
bool isNotEmpty() const
A scope specifier is present, but may be valid or invalid.
char * location_data() const
Retrieve the data associated with the source-location information.
bool isValid() const
A scope specifier is present, and it refers to a real scope.
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
SourceLocation getLastQualifierNameLoc() const
Retrieve the location of the name in the last qualifier in this nested name specifier.
SourceLocation getEndLoc() const
void setRange(SourceRange R)
void setBeginLoc(SourceLocation Loc)
SourceRange getRange() const
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
SourceLocation getBeginLoc() const
bool isSet() const
Deprecated.
ArrayRef< TemplateParameterList * > getTemplateParamLists() const
void setEndLoc(SourceLocation Loc)
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
void SetInvalid(SourceRange R)
Indicate that this nested-name-specifier is invalid.
unsigned location_size() const
Retrieve the size of the data associated with source-location information.
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
bool isInvalid() const
An error occurred during parsing of the scope specifier.
void setTemplateParamLists(ArrayRef< TemplateParameterList * > L)
bool isEmpty() const
No scope specifier.
void Adopt(NestedNameSpecifierLoc Other)
Adopt an existing nested-name-specifier (with source-range information).
Captures information about "declaration specifiers".
bool isVirtualSpecified() const
bool setFunctionSpecExplicit(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, ExplicitSpecifier ExplicitSpec, SourceLocation CloseParenLoc)
const WrittenBuiltinSpecs & getWrittenBuiltinSpecs() const
bool isTypeSpecPipe() const
bool isModulePrivateSpecified() const
static const TSCS TSCS___thread
void UpdateDeclRep(Decl *Rep)
static const TST TST_typeof_unqualType
SourceLocation getTypeSpecSignLoc() const
void setTypeArgumentRange(SourceRange range)
bool SetTypePipe(bool isPipe, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
SourceLocation getPipeLoc() const
bool hasAutoTypeSpec() const
static const TST TST_typename
SourceLocation getEndLoc() const LLVM_READONLY
bool hasTypeSpecifier() const
Return true if any type-specifier has been found.
bool SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
These methods set the specified attribute of the DeclSpec and return false if there was no error.
const ParsedAttributes & getAttributes() const
ThreadStorageClassSpecifier TSCS
void setObjCQualifiers(ObjCDeclSpec *quals)
static const TST TST_char8
static const TST TST_BFloat16
Expr * getPackIndexingExpr() const
void ClearStorageClassSpecs()
bool SetConstexprSpec(ConstexprSpecKind ConstexprKind, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TSCS TSCS__Thread_local
bool SetTypeSpecWidth(TypeSpecifierWidth W, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
These methods set the specified attribute of the DeclSpec, but return true and ignore the request if ...
bool isNoreturnSpecified() const
TST getTypeSpecType() const
SourceLocation getStorageClassSpecLoc() const
SCS getStorageClassSpec() const
bool setModulePrivateSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
SourceLocation getBeginLoc() const LLVM_READONLY
bool isTypeSpecSat() const
bool SetTypeSpecSat(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
SourceRange getSourceRange() const LLVM_READONLY
void SetPackIndexingExpr(SourceLocation EllipsisLoc, Expr *Pack)
bool SetStorageClassSpecThread(TSCS TSC, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
void SetRangeEnd(SourceLocation Loc)
ObjCDeclSpec * getObjCQualifiers() const
bool SetBitIntType(SourceLocation KWLoc, Expr *BitWidth, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
static const TST TST_auto_type
static const TST TST_interface
static const TST TST_double
static const TST TST_typeofExpr
unsigned getTypeQualifiers() const
getTypeQualifiers - Return a set of TQs.
void SetRangeStart(SourceLocation Loc)
bool SetTypeAltiVecPixel(bool isAltiVecPixel, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
bool SetFriendSpec(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
SourceLocation getNoreturnSpecLoc() const
TemplateIdAnnotation * getRepAsTemplateId() const
bool isExternInLinkageSpec() const
const CXXScopeSpec & getTypeSpecScope() const
static const TST TST_union
static const TST TST_typename_pack_indexing
static const TST TST_char
static const TST TST_bool
static const TST TST_char16
SCS
storage-class-specifier
SourceLocation getExplicitSpecLoc() const
static const TST TST_unknown_anytype
SourceLocation getAltiVecLoc() const
SourceLocation getFriendSpecLoc() const
TSC getTypeSpecComplex() const
SourceLocation getModulePrivateSpecLoc() const
void forEachCVRUQualifier(llvm::function_ref< void(TQ, StringRef, SourceLocation)> Handle)
This method calls the passed in handler on each CVRU qual being set.
bool SetTypeSpecComplex(TSC C, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
bool isMissingDeclaratorOk()
Checks if this DeclSpec can stand alone, without a Declarator.
ParsedType getRepAsType() const
void UpdateTypeRep(ParsedType Rep)
TSCS getThreadStorageClassSpec() const
bool isFriendSpecifiedFirst() const
bool setFunctionSpecNoreturn(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
bool hasAttributes() const
static const TST TST_accum
static const TST TST_half
ParsedAttributes & getAttributes()
SourceLocation getEllipsisLoc() const
bool isTypeAltiVecPixel() const
void ClearTypeQualifiers()
Clear out all of the type qualifiers.
SourceLocation getConstSpecLoc() const
SourceRange getExplicitSpecRange() const
static const TST TST_ibm128
DeclSpec(AttributeFactory &attrFactory)
Expr * getRepAsExpr() const
void addAttributes(const ParsedAttributesView &AL)
Concatenates two attribute lists.
static const TST TST_enum
bool SetTypeAltiVecBool(bool isAltiVecBool, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
AttributePool & getAttributePool() const
static const TST TST_float128
static const TST TST_decltype
SourceRange getTypeSpecWidthRange() const
SourceLocation getTypeSpecTypeNameLoc() const
static bool isDeclRep(TST T)
void Finish(Sema &S, const PrintingPolicy &Policy)
Finish - This does final analysis of the declspec, issuing diagnostics for things like "_Complex" (la...
bool isInlineSpecified() const
SourceLocation getTypeSpecWidthLoc() const
SourceLocation getRestrictSpecLoc() const
static const TST TST_typeof_unqualExpr
static const TST TST_class
bool hasTagDefinition() const
static const TST TST_decimal64
unsigned getParsedSpecifiers() const
Return a bitmask of which flavors of specifiers this DeclSpec includes.
bool isTypeAltiVecBool() const
void ClearFunctionSpecs()
bool isConstrainedAuto() const
bool SetTypeQual(TQ T, SourceLocation Loc)
static const TST TST_wchar
SourceLocation getTypeSpecComplexLoc() const
static const TST TST_void
static const TSCS TSCS_unspecified
bool isTypeAltiVecVector() const
static const TST TST_bitint
void ClearConstexprSpec()
static const char * getSpecifierName(DeclSpec::TST T, const PrintingPolicy &Policy)
Turn a type-specifier-type into a string like "_Bool" or "union".
static const TST TST_float
static const TST TST_atomic
static const TST TST_fract
SourceLocation getThreadStorageClassSpecLoc() const
Decl * getRepAsDecl() const
static const TST TST_float16
static bool isTransformTypeTrait(TST T)
static const TST TST_unspecified
SourceLocation getAtomicSpecLoc() const
SourceLocation getVirtualSpecLoc() const
TypeSpecifierSign getTypeSpecSign() const
SourceLocation getConstexprSpecLoc() const
CXXScopeSpec & getTypeSpecScope()
bool isEmpty() const
isEmpty - Return true if this declaration specifier is completely empty: no tokens were parsed in the...
SourceLocation getTypeSpecTypeLoc() const
void UpdateExprRep(Expr *Rep)
bool SetTypeSpecType(TST T, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, TypeResult Rep, const PrintingPolicy &Policy)
static const TST TST_decltype_auto
static const TSCS TSCS_thread_local
void setExternInLinkageSpec(bool Value)
static const TST TST_error
void forEachQualifier(llvm::function_ref< void(TQ, StringRef, SourceLocation)> Handle)
This method calls the passed in handler on each qual being set.
bool setFunctionSpecVirtual(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_decimal32
bool SetTypeAltiVecVector(bool isAltiVecVector, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID, const PrintingPolicy &Policy)
TypeSpecifierWidth getTypeSpecWidth() const
ExplicitSpecifier getExplicitSpecifier() const
static const TST TST_char32
bool setFunctionSpecInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_decimal128
bool isTypeSpecOwned() const
SourceLocation getTypeSpecSatLoc() const
SourceRange getTypeofParensRange() const
SourceLocation getInlineSpecLoc() const
SourceLocation getUnalignedSpecLoc() const
static const TST TST_int128
SourceLocation getVolatileSpecLoc() const
FriendSpecified isFriendSpecified() const
bool hasExplicitSpecifier() const
bool setFunctionSpecForceInline(SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
bool hasConstexprSpecifier() const
void takeAttributesFrom(ParsedAttributes &attrs)
static const TST TST_typeofType
TemplateIdAnnotation * TemplateIdRep
bool SetTypeSpecSign(TypeSpecifierSign S, SourceLocation Loc, const char *&PrevSpec, unsigned &DiagID)
static const TST TST_auto
ParsedSpecifiers
ParsedSpecifiers - Flags to query which specifiers were applied.
@ PQ_StorageClassSpecifier
ConstexprSpecKind getConstexprSpecifier() const
static const TST TST_struct
Decl - This represents one declaration (or definition), e.g.
Information about one declarator, including the parsed type information and the identifier.
DeclaratorChunk & getTypeObject(unsigned i)
bool isFunctionDeclarator(unsigned &idx) const
isFunctionDeclarator - This method returns true if the declarator is a function declarator (looking t...
bool isPastIdentifier() const
isPastIdentifier - Return true if we have parsed beyond the point where the name would appear.
bool isArrayOfUnknownBound() const
isArrayOfUnknownBound - This method returns true if the declarator is a declarator for an array of un...
bool isDeclarationOfFunction() const
Determine whether the declaration that will be produced from this declaration will be a function.
void SetRangeBegin(SourceLocation Loc)
SetRangeBegin - Set the start of the source range to Loc, unless it's invalid.
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
bool hasAttributes() const
hasAttributes - do we contain any attributes?
void setCommaLoc(SourceLocation CL)
bool hasPackIndexing() const
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
SmallVectorImpl< DeclaratorChunk >::const_iterator type_object_iterator
const DeclaratorChunk * getInnermostNonParenChunk() const
Return the innermost (closest to the declarator) chunk of this declarator that is not a parens chunk,...
void AddTypeInfo(const DeclaratorChunk &TI, AttributePool &OtherPool, SourceLocation EndLoc)
AddTypeInfo - Add a chunk to this declarator.
Expr * getAsmLabel() const
void AddInnermostTypeInfo(const DeclaratorChunk &TI)
Add a new innermost chunk to this declarator.
bool isFunctionDeclarationContext() const
Return true if this declaration appears in a context where a function declarator would be a function ...
FunctionDefinitionKind getFunctionDefinitionKind() const
const ParsedAttributes & getAttributes() const
void setRedeclaration(bool Val)
bool isObjCWeakProperty() const
SourceLocation getIdentifierLoc() const
void SetIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Set the name of this declarator to be the given identifier.
bool mayOmitIdentifier() const
mayOmitIdentifier - Return true if the identifier is either optional or not allowed.
bool isFunctionDeclarator() const
isFunctionDeclarator - Once this declarator is fully parsed and formed, this method returns true if t...
bool hasTrailingReturnType() const
Determine whether a trailing return type was written (at any level) within this declarator.
SourceLocation getEndLoc() const LLVM_READONLY
void setObjCIvar(bool Val=true)
bool mayBeFollowedByCXXDirectInit() const
mayBeFollowedByCXXDirectInit - Return true if the declarator can be followed by a C++ direct initiali...
Expr * getTrailingRequiresClause()
Sets a trailing requires clause for this declarator.
bool isExpressionContext() const
Determine whether this declaration appears in a context where an expression could appear.
Expr * getPackIndexingExpr() const
type_object_range type_objects() const
Returns the range of type objects, from the identifier outwards.
bool hasGroupingParens() const
void setDecompositionBindings(SourceLocation LSquareLoc, MutableArrayRef< DecompositionDeclarator::Binding > Bindings, SourceLocation RSquareLoc)
Set the decomposition bindings for this declarator.
void setInvalidType(bool Val=true)
void DropFirstTypeObject()
TemplateParameterList * getInventedTemplateParameterList() const
The template parameter list generated from the explicit template parameters along with any invented t...
void SetSourceRange(SourceRange R)
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
bool mayHaveIdentifier() const
mayHaveIdentifier - Return true if the identifier is either optional or required.
void setGroupingParens(bool flag)
const DeclaratorChunk * getOutermostNonParenChunk() const
Return the outermost (furthest from the declarator) chunk of this declarator that is not a parens chu...
bool isRedeclaration() const
DeclaratorChunk::ParamInfo InlineParams[16]
InlineParams - This is a local array used for the first function decl chunk to avoid going to the hea...
const ParsedAttributesView & getDeclarationAttributes() const
Declarator(const DeclSpec &DS, const ParsedAttributesView &DeclarationAttrs, DeclaratorContext C)
DS and DeclarationAttrs must outlive the Declarator.
SourceLocation getEllipsisLoc() const
DeclaratorContext getContext() const
const DecompositionDeclarator & getDecompositionDeclarator() const
SourceLocation getBeginLoc() const LLVM_READONLY
bool isCtorOrDtor()
Returns true if this declares a constructor or a destructor.
bool isFunctionDefinition() const
void setTrailingRequiresClause(Expr *TRC)
Sets a trailing requires clause for this declarator.
void setHasInitializer(bool Val=true)
UnqualifiedId & getName()
Retrieve the name specified by this declarator.
void setTemplateParameterLists(ArrayRef< TemplateParameterList * > TPLs)
Sets the template parameter lists that preceded the declarator.
bool isFirstDeclarator() const
bool hasTrailingRequiresClause() const
Determine whether a trailing requires clause was written in this declarator.
bool hasInitializer() const
SourceLocation getCommaLoc() const
void setFunctionDefinitionKind(FunctionDefinitionKind Val)
AttributePool & getAttributePool() const
const CXXScopeSpec & getCXXScopeSpec() const
getCXXScopeSpec - Return the C++ scope specifier (global scope or nested-name-specifier) that is part...
void takeAttributes(ParsedAttributes &attrs)
takeAttributes - Takes attributes from the given parsed-attributes set and add them to this declarato...
bool hasName() const
hasName - Whether this declarator has a name, which might be an identifier (accessible via getIdentif...
ArrayRef< TemplateParameterList * > getTemplateParameterLists() const
The template parameter lists that preceded the declarator.
bool isFunctionDeclaratorAFunctionDeclaration() const
Return true if a function declarator at this position would be a function declaration.
ParsedType getTrailingReturnType() const
Get the trailing return type appearing (at any level) within this declarator.
void setInventedTemplateParameterList(TemplateParameterList *Invented)
Sets the template parameter list generated from the explicit template parameters along with any inven...
void clear()
Reset the contents of this Declarator.
void AddTypeInfo(const DeclaratorChunk &TI, SourceLocation EndLoc)
AddTypeInfo - Add a chunk to this declarator.
ParsedAttributes & getAttributes()
void setAsmLabel(Expr *E)
void AddTypeInfo(const DeclaratorChunk &TI, ParsedAttributes &&attrs, SourceLocation EndLoc)
AddTypeInfo - Add a chunk to this declarator.
CXXScopeSpec & getCXXScopeSpec()
void ExtendWithDeclSpec(const DeclSpec &DS)
ExtendWithDeclSpec - Extend the declarator source range to include the given declspec,...
void SetRangeEnd(SourceLocation Loc)
SetRangeEnd - Set the end of the source range to Loc, unless it's invalid.
void setExtension(bool Val=true)
bool mayHaveDecompositionDeclarator() const
Return true if the context permits a C++17 decomposition declarator.
bool isInvalidType() const
bool isExplicitObjectMemberFunction()
SourceRange getSourceRange() const LLVM_READONLY
Get the source range that spans this declarator.
void setObjCWeakProperty(bool Val=true)
bool isDecompositionDeclarator() const
Return whether this declarator is a decomposition declarator.
bool isFirstDeclarationOfMember()
Returns true if this declares a real member and not a friend.
bool isPrototypeContext() const
llvm::iterator_range< type_object_iterator > type_object_range
bool isStaticMember()
Returns true if this declares a static member.
DecompositionDeclarator::Binding InlineBindings[16]
void setPackIndexingExpr(Expr *PI)
bool getExtension() const
const DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo() const
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
DeclSpec & getMutableDeclSpec()
getMutableDeclSpec - Return a non-const version of the DeclSpec.
DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo()
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
void setEllipsisLoc(SourceLocation EL)
const IdentifierInfo * getIdentifier() const
A parsed C++17 decomposition declarator of the form '[' identifier-list ']'.
~DecompositionDeclarator()
DecompositionDeclarator & operator=(const DecompositionDeclarator &G)=delete
ArrayRef< Binding > bindings() const
SourceRange getSourceRange() const
DecompositionDeclarator()
SourceLocation getLSquareLoc() const
DecompositionDeclarator(const DecompositionDeclarator &G)=delete
SourceLocation getRSquareLoc() const
Store information needed for an explicit specifier.
const Expr * getExpr() const
bool isSpecified() const
Determine if the declaration had an explicit specifier of any kind.
This represents one expression.
One of these records is kept for each identifier that is lexed.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
This represents a decl that may have a name.
Represents a C++ namespace alias.
Represent a C++ namespace.
Class that aids in the construction of nested-name-specifiers along with source-location information ...
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector::".
Captures information about "declaration specifiers" specific to Objective-C.
void setObjCDeclQualifier(ObjCDeclQualifier DQVal)
ObjCPropertyAttribute::Kind getPropertyAttributes() const
IdentifierInfo * getSetterName()
void clearObjCDeclQualifier(ObjCDeclQualifier DQVal)
ObjCDeclQualifier
ObjCDeclQualifier - Qualifier used on types in method declarations.
void setSetterName(IdentifierInfo *name, SourceLocation loc)
const IdentifierInfo * getSetterName() const
ObjCDeclQualifier getObjCDeclQualifier() const
SourceLocation getGetterNameLoc() const
SourceLocation getNullabilityLoc() const
NullabilityKind getNullability() const
SourceLocation getSetterNameLoc() const
void setGetterName(IdentifierInfo *name, SourceLocation loc)
void setNullability(SourceLocation loc, NullabilityKind kind)
const IdentifierInfo * getGetterName() const
void setPropertyAttributes(ObjCPropertyAttribute::Kind PRVal)
IdentifierInfo * getGetterName()
ParsedAttr - Represents a syntactic attribute.
void addAll(iterator B, iterator E)
ParsedAttributes - A collection of parsed attributes.
AttributePool & getPool() const
void takeAllFrom(ParsedAttributes &Other)
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Scope - A scope is a transient data structure that is used while parsing the program.
Sema - This implements semantic analysis and AST building for C.
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.
SourceLocation getEnd() const
SourceLocation getBegin() const
SourceLocation getEndLoc() const LLVM_READONLY
Represents a C++ template name within the type system.
Stores a list of template parameters for a TemplateDecl and its derived classes.
Base wrapper for a particular "section" of type source info.
Represents a C++ unqualified-id that has been parsed.
struct OFI OperatorFunctionId
When Kind == IK_OperatorFunctionId, the overloaded operator that we parsed.
UnionParsedType ConversionFunctionId
When Kind == IK_ConversionFunctionId, the type that the conversion function names.
void setLiteralOperatorId(const IdentifierInfo *Id, SourceLocation OpLoc, SourceLocation IdLoc)
Specific that this unqualified-id was parsed as a literal-operator-id.
SourceLocation getBeginLoc() const LLVM_READONLY
void setIdentifier(const IdentifierInfo *Id, SourceLocation IdLoc)
Specify that this unqualified-id was parsed as an identifier.
UnionParsedType ConstructorName
When Kind == IK_ConstructorName, the class-name of the type whose constructor is being referenced.
SourceLocation EndLocation
The location of the last token that describes this unqualified-id.
void setOperatorFunctionId(SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
Specify that this unqualified-id was parsed as an operator-function-id.
bool isValid() const
Determine whether this unqualified-id refers to a valid name.
void setImplicitSelfParam(const IdentifierInfo *Id)
Specify that this unqualified-id is an implicit 'self' parameter.
bool isInvalid() const
Determine whether this unqualified-id refers to an invalid name.
void setDeductionGuideName(ParsedTemplateTy Template, SourceLocation TemplateLoc)
Specify that this unqualified-id was parsed as a template-name for a deduction-guide.
SourceRange getSourceRange() const LLVM_READONLY
Return the source range that covers this unqualified-id.
void setConversionFunctionId(SourceLocation OperatorLoc, ParsedType Ty, SourceLocation EndLoc)
Specify that this unqualified-id was parsed as a conversion-function-id.
void setDestructorName(SourceLocation TildeLoc, ParsedType ClassType, SourceLocation EndLoc)
Specify that this unqualified-id was parsed as a destructor name.
void setTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id.
SourceLocation getEndLoc() const LLVM_READONLY
UnionParsedType DestructorName
When Kind == IK_DestructorName, the type referred to by the class-name.
void setConstructorTemplateId(TemplateIdAnnotation *TemplateId)
Specify that this unqualified-id was parsed as a template-id that names a constructor.
SourceLocation StartLocation
The location of the first token that describes this unqualified-id, which will be the location of the...
void setConstructorName(ParsedType ClassType, SourceLocation ClassNameLoc, SourceLocation EndLoc)
Specify that this unqualified-id was parsed as a constructor name.
UnionParsedTemplateTy TemplateName
When Kind == IK_DeductionGuideName, the parsed template-name.
const IdentifierInfo * Identifier
When Kind == IK_Identifier, the parsed identifier, or when Kind == IK_UserLiteralId,...
void clear()
Clear out this unqualified-id, setting it to default (invalid) state.
UnqualifiedIdKind getKind() const
Determine what kind of name we have.
TemplateIdAnnotation * TemplateId
When Kind == IK_TemplateId or IK_ConstructorTemplateId, the template-id annotation that contains the ...
Represents a C++11 virt-specifier-seq.
SourceLocation getOverrideLoc() const
Specifier getLastSpecifier() const
SourceLocation getFirstLocation() const
SourceLocation getLastLocation() const
SourceLocation getAbstractLoc() const
bool isOverrideSpecified() const
SourceLocation getFinalLoc() const
bool isFinalSpecified() const
bool isFinalSpelledSealed() const
static const char * getSpecifierName(Specifier VS)
bool SetSpecifier(Specifier VS, SourceLocation Loc, const char *&PrevSpec)
@ kind_nullability
Indicates that the nullability of the type was spelled with a property attribute rather than a type q...
@ Extend
Lifetime-extend along this path.
The JSON file list parser is used to communicate input to InstallAPI.
TypeSpecifierType
Specifies the kind of type.
@ TST_typename_pack_indexing
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
FunctionDefinitionKind
Described the kind of function definition (if any) provided for a function.
@ NumObjCPropertyAttrsBits
Number of bits fitting all the property attributes.
ConstexprSpecKind
Define the kind of constexpr specifier.
NullabilityKind
Describes the nullability of a particular type.
LambdaCaptureKind
The different capture forms in a lambda introducer.
UnqualifiedIdKind
Describes the kind of unqualified-id parsed.
@ IK_DeductionGuideName
A deduction-guide name (a template-name)
@ IK_ImplicitSelfParam
An implicit 'self' parameter.
@ IK_TemplateId
A template-id, e.g., f.
@ IK_ConstructorTemplateId
A constructor named via a template-id.
@ IK_ConstructorName
A constructor name.
@ IK_LiteralOperatorId
A user-defined literal name, e.g., operator "" _i.
@ IK_Identifier
An identifier.
@ IK_DestructorName
A destructor name.
@ IK_OperatorFunctionId
An overloaded operator name, e.g., operator+.
@ IK_ConversionFunctionId
A conversion function name, e.g., operator int.
ThreadStorageClassSpecifier
Thread storage-class-specifier.
@ TSCS_thread_local
C++11 thread_local.
@ TSCS__Thread_local
C11 _Thread_local.
@ TSCS___thread
GNU __thread.
@ CopyInit
[a = b], [a = {b}]
TypeSpecifierWidth
Specifies the width of a type, e.g., short, long, or long long.
ActionResult< ParsedType > TypeResult
TypeSpecifierSign
Specifies the signedness of a type, e.g., signed or unsigned.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
const FunctionProtoType * T
SmallVector< Token, 4 > CachedTokens
A set of tokens that has been cached for later parsing.
@ Other
Other implicit parameter.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Unparsed
not parsed yet
@ EST_None
no exception specification
@ EST_Dynamic
throw(T1, T2)
unsigned isStar
True if this dimension was [*]. In this case, NumElts is null.
unsigned TypeQuals
The type qualifiers for the array: const/volatile/restrict/__unaligned/_Atomic.
unsigned hasStatic
True if this dimension included the 'static' keyword.
Expr * NumElts
This is the size of the array, or null if [] or [*] was specified.
unsigned TypeQuals
For now, sema will catch these as invalid.
SourceLocation getConstQualifierLoc() const
Retrieve the location of the 'const' qualifier.
unsigned isVariadic
isVariadic - If this function has a prototype, and if that proto ends with ',...)',...
SourceLocation getTrailingReturnTypeLoc() const
Get the trailing-return-type location for this function declarator.
SourceLocation getLParenLoc() const
CachedTokens * ExceptionSpecTokens
Pointer to the cached tokens for an exception-specification that has not yet been parsed.
SourceLocation MutableLoc
The location of the 'mutable' qualifer in a lambda-declarator, if any.
SourceLocation getRestrictQualifierLoc() const
Retrieve the location of the 'restrict' qualifier.
bool hasTrailingReturnType() const
Determine whether this function declarator had a trailing-return-type.
UnionParsedType TrailingReturnType
If HasTrailingReturnType is true, this is the trailing return type specified.
TypeAndRange * Exceptions
Pointer to a new[]'d array of TypeAndRange objects that contain the types in the function's dynamic e...
ParamInfo * Params
Params - This is a pointer to a new[]'d array of ParamInfo objects that describe the parameters speci...
ParsedType getTrailingReturnType() const
Get the trailing-return-type for this function declarator.
unsigned RefQualifierIsLValueRef
Whether the ref-qualifier (if any) is an lvalue reference.
SourceLocation getExceptionSpecLocBeg() const
NamedDecl ** DeclsInPrototype
Pointer to a new[]'d array of declarations that need to be available for lookup inside the function b...
AttributeFactory * QualAttrFactory
AttributeFactory for the MethodQualifiers.
SourceLocation ExceptionSpecLocEnd
The end location of the exception specification, if any.
SourceLocation EllipsisLoc
When isVariadic is true, the location of the ellipsis in the source.
ArrayRef< NamedDecl * > getDeclsInPrototype() const
Get the non-parameter decls defined within this function prototype.
unsigned DeleteParams
DeleteParams - If this is true, we need to delete[] Params.
DeclSpec * MethodQualifiers
DeclSpec for the function with the qualifier related info.
SourceLocation getRefQualifierLoc() const
Retrieve the location of the ref-qualifier, if any.
unsigned NumExceptionsOrDecls
NumExceptionsOrDecls - This is the number of types in the dynamic-exception-decl, if the function has...
SourceLocation getRParenLoc() const
SourceLocation RefQualifierLoc
The location of the ref-qualifier, if any.
SourceLocation getExceptionSpecLocEnd() const
SourceLocation getVolatileQualifierLoc() const
Retrieve the location of the 'volatile' qualifier.
SourceLocation getEllipsisLoc() const
SourceLocation RParenLoc
The location of the right parenthesis in the source.
unsigned NumParams
NumParams - This is the number of formal parameters specified by the declarator.
unsigned getNumExceptions() const
Get the number of dynamic exception specifications.
bool hasMutableQualifier() const
Determine whether this lambda-declarator contains a 'mutable' qualifier.
bool isKNRPrototype() const
isKNRPrototype - Return true if this is a K&R style identifier list, like "void foo(a,...
bool hasMethodTypeQualifiers() const
Determine whether this method has qualifiers.
unsigned HasTrailingReturnType
HasTrailingReturnType - If this is true, a trailing return type was specified.
unsigned isAmbiguous
Can this declaration be a constructor-style initializer?
DeclSpec & getOrCreateMethodQualifiers()
void freeParams()
Reset the parameter list to having zero parameters.
unsigned hasPrototype
hasPrototype - This is true if the function had at least one typed parameter.
bool hasRefQualifier() const
Determine whether this function declaration contains a ref-qualifier.
SourceRange getExceptionSpecRange() const
SourceLocation getMutableLoc() const
Retrieve the location of the 'mutable' qualifier, if any.
SourceLocation LParenLoc
The location of the left parenthesis in the source.
unsigned ExceptionSpecType
ExceptionSpecType - An ExceptionSpecificationType value.
SourceLocation ExceptionSpecLocBeg
The beginning location of the exception specification, if any.
ExceptionSpecificationType getExceptionSpecType() const
Get the type of exception specification this function has.
SourceLocation TrailingReturnTypeLoc
If HasTrailingReturnType is true, this is the location of the trailing return type.
Expr * NoexceptExpr
Pointer to the expression in the noexcept-specifier of this function, if it has one.
const CXXScopeSpec & Scope() const
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/__unaligned/_Atomic.
SourceLocation StarLoc
Location of the '*' token.
char ScopeMem[sizeof(CXXScopeSpec)]
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed.
std::unique_ptr< CachedTokens > DefaultArgTokens
DefaultArgTokens - When the parameter's default argument cannot be parsed immediately (because it occ...
const IdentifierInfo * Ident
ParamInfo(const IdentifierInfo *ident, SourceLocation iloc, Decl *param, std::unique_ptr< CachedTokens > DefArgTokens=nullptr)
unsigned AccessWrites
The access writes.
SourceLocation RestrictQualLoc
The location of the restrict-qualifier, if any.
SourceLocation ConstQualLoc
The location of the const-qualifier, if any.
SourceLocation VolatileQualLoc
The location of the volatile-qualifier, if any.
SourceLocation UnalignedQualLoc
The location of the __unaligned-qualifier, if any.
unsigned TypeQuals
The type qualifiers: const/volatile/restrict/unaligned/atomic.
SourceLocation AtomicQualLoc
The location of the _Atomic-qualifier, if any.
bool LValueRef
True if this is an lvalue reference, false if it's an rvalue reference.
bool HasRestrict
The type qualifier: restrict. [GNU] C++ extension.
One instance of this struct is used for each type in a declarator that is parsed.
SourceRange getSourceRange() const
const ParsedAttributesView & getAttrs() const
If there are attributes applied to this declaratorchunk, return them.
enum clang::DeclaratorChunk::@225 Kind
static DeclaratorChunk getBlockPointer(unsigned TypeQuals, SourceLocation Loc)
Return a DeclaratorChunk for a block.
SourceLocation EndLoc
EndLoc - If valid, the place where this chunck ends.
static DeclaratorChunk getFunction(bool HasProto, bool IsAmbiguous, SourceLocation LParenLoc, ParamInfo *Params, unsigned NumParams, SourceLocation EllipsisLoc, SourceLocation RParenLoc, bool RefQualifierIsLvalueRef, SourceLocation RefQualifierLoc, SourceLocation MutableLoc, ExceptionSpecificationType ESpecType, SourceRange ESpecRange, ParsedType *Exceptions, SourceRange *ExceptionRanges, unsigned NumExceptions, Expr *NoexceptExpr, CachedTokens *ExceptionSpecTokens, ArrayRef< NamedDecl * > DeclsInPrototype, SourceLocation LocalRangeBegin, SourceLocation LocalRangeEnd, Declarator &TheDeclarator, TypeResult TrailingReturnType=TypeResult(), SourceLocation TrailingReturnTypeLoc=SourceLocation(), DeclSpec *MethodQualifiers=nullptr)
DeclaratorChunk::getFunction - Return a DeclaratorChunk for a function.
static DeclaratorChunk getPipe(unsigned TypeQuals, SourceLocation Loc)
Return a DeclaratorChunk for a block.
ParsedAttributesView & getAttrs()
MemberPointerTypeInfo Mem
static DeclaratorChunk getArray(unsigned TypeQuals, bool isStatic, bool isStar, Expr *NumElts, SourceLocation LBLoc, SourceLocation RBLoc)
Return a DeclaratorChunk for an array.
SourceLocation Loc
Loc - The place where this type was defined.
ParsedAttributesView AttrList
static DeclaratorChunk getMemberPointer(const CXXScopeSpec &SS, unsigned TypeQuals, SourceLocation StarLoc, SourceLocation EndLoc)
static DeclaratorChunk getParen(SourceLocation LParenLoc, SourceLocation RParenLoc)
Return a DeclaratorChunk for a paren.
static DeclaratorChunk getPointer(unsigned TypeQuals, SourceLocation Loc, SourceLocation ConstQualLoc, SourceLocation VolatileQualLoc, SourceLocation RestrictQualLoc, SourceLocation AtomicQualLoc, SourceLocation UnalignedQualLoc)
Return a DeclaratorChunk for a pointer.
static DeclaratorChunk getReference(unsigned TypeQuals, SourceLocation Loc, bool lvalue)
Return a DeclaratorChunk for a reference.
std::optional< ParsedAttributes > Attrs
This little struct is used to capture information about structure field declarators,...
FieldDeclarator(const DeclSpec &DS, const ParsedAttributes &DeclarationAttrs)
Wraps an identifier and optional source location for the identifier.
unsigned NumExplicitTemplateParams
The number of parameters in the template parameter list that were explicitly specified by the user,...
SmallVector< NamedDecl *, 4 > TemplateParams
Store the list of the template parameters for a generic lambda or an abbreviated function template.
unsigned AutoTemplateParameterDepth
If this is a generic lambda or abbreviated function template, use this as the depth of each 'auto' pa...
An individual capture in a lambda introducer.
SourceRange ExplicitRange
SourceLocation EllipsisLoc
ParsedType InitCaptureType
LambdaCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, LambdaCaptureInitKind InitKind, ExprResult Init, ParsedType InitCaptureType, SourceRange ExplicitRange)
LambdaCaptureInitKind InitKind
Represents a complete lambda introducer.
LambdaIntroducer()=default
bool hasLambdaCapture() const
SmallVector< LambdaCapture, 4 > Captures
void addCapture(LambdaCaptureKind Kind, SourceLocation Loc, IdentifierInfo *Id, SourceLocation EllipsisLoc, LambdaCaptureInitKind InitKind, ExprResult Init, ParsedType InitCaptureType, SourceRange ExplicitRange)
Append a capture in a lambda introducer.
SourceLocation DefaultLoc
LambdaCaptureDefault Default
Describes how types, statements, expressions, and declarations should be printed.
Information about a template-id annotation token.
SourceLocation SymbolLocations[3]
The source locations of the individual tokens that name the operator, e.g., the "new",...
OverloadedOperatorKind Operator
The kind of overloaded operator.
Structure that packs information about the type specifiers that were written in a particular type spe...