clang: lib/Sema/SemaLambda.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
30#include "llvm/ADT/STLExtras.h"
31#include
32using namespace clang;
33using namespace sema;
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70static inline std::optional
74
75 const std::optional NoLambdaIsCaptureReady;
76
77
78 unsigned CurScopeIndex = FunctionScopes.size() - 1;
79 while (CurScopeIndex > 0 && isaclang::sema::CapturedRegionScopeInfo(
80 FunctionScopes[CurScopeIndex]))
81 --CurScopeIndex;
82 assert(
83 isaclang::sema::LambdaScopeInfo(FunctionScopes[CurScopeIndex]) &&
84 "The function on the top of sema's function-info stack must be a lambda");
85
86
87 const bool IsCapturingThis = !VarToCapture;
88 const bool IsCapturingVariable = !IsCapturingThis;
89
90
92 castsema::LambdaScopeInfo(FunctionScopes[CurScopeIndex])->CallOperator;
93
94 do {
96 castsema::LambdaScopeInfo(FunctionScopes[CurScopeIndex]);
97
98
99
100
101
102
103
104 if (IsCapturingVariable &&
106 return NoLambdaIsCaptureReady;
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124 if (LSI->ImpCaptureStyle == sema::LambdaScopeInfo::ImpCap_None) {
125 if (IsCapturingVariable && !LSI->isCaptured(VarToCapture))
126 return NoLambdaIsCaptureReady;
128 return NoLambdaIsCaptureReady;
129 }
131
132 assert(CurScopeIndex);
133 --CurScopeIndex;
137
138 assert(CurScopeIndex < (FunctionScopes.size() - 1));
139
140
142 return CurScopeIndex + 1;
143 return NoLambdaIsCaptureReady;
144}
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181std::optional
185
186 const std::optional NoLambdaIsCaptureCapable;
187
188 const std::optional OptionalStackIndex =
190 VarToCapture);
191 if (!OptionalStackIndex)
192 return NoLambdaIsCaptureCapable;
193
194 const unsigned IndexOfCaptureReadyLambda = *OptionalStackIndex;
195 assert(((IndexOfCaptureReadyLambda != (FunctionScopes.size() - 1)) ||
197 "The capture ready lambda for a potential capture can only be the "
198 "current lambda if it is a generic lambda");
199
201 castsema::LambdaScopeInfo(FunctionScopes[IndexOfCaptureReadyLambda]);
202
203
204 const bool IsCapturingThis = !VarToCapture;
205 const bool IsCapturingVariable = !IsCapturingThis;
206
207 if (IsCapturingVariable) {
208
209
210
211 QualType CaptureType, DeclRefType;
212 const bool CanCaptureVariable =
217 false, CaptureType,
218 DeclRefType, &IndexOfCaptureReadyLambda);
219 if (!CanCaptureVariable)
220 return NoLambdaIsCaptureCapable;
221 } else {
222
223
224
225 const bool CanCaptureThis =
228 false, false,
229 &IndexOfCaptureReadyLambda);
230 if (!CanCaptureThis)
231 return NoLambdaIsCaptureCapable;
232 }
233 return IndexOfCaptureReadyLambda;
234}
235
246 }
248}
249
252 unsigned LambdaDependencyKind,
257
258 bool IsGenericLambda =
260
262 Context, DC, Info, IntroducerRange.getBegin(), LambdaDependencyKind,
263 IsGenericLambda, CaptureDefault);
265
267}
268
269
270
273 if (const FunctionDecl *FD = dyn_cast(DC))
274 if (FD->isInlined())
275 return true;
276
278 }
279
280 return false;
281}
282
283std::tuple<MangleNumberingContext *, Decl *>
285
286
288
289 enum ContextKind {
292 DataMember,
293 InlineVariable,
294 TemplatedVariable,
297
298 bool IsInNonspecializedTemplate =
300
301
302
303
304 if (ManglingContextDecl) {
305 if (ParmVarDecl *Param = dyn_cast(ManglingContextDecl)) {
308 if (LexicalDC->isRecord())
310 } else if (VarDecl *Var = dyn_cast(ManglingContextDecl)) {
311 if (Var->getMostRecentDecl()->isInline())
312 Kind = InlineVariable;
313 else if (Var->getDeclContext()->isRecord() && IsInNonspecializedTemplate)
314 Kind = TemplatedVariable;
315 else if (Var->getDescribedVarTemplate())
316 Kind = TemplatedVariable;
317 else if (auto *VTS = dyn_cast(Var)) {
318 if (!VTS->isExplicitSpecialization())
319 Kind = TemplatedVariable;
320 }
321 } else if (isa(ManglingContextDecl)) {
322 Kind = DataMember;
323 } else if (isa(ManglingContextDecl)) {
325 }
326 }
327
328
329
330
331 switch (Kind) {
333
334 if ((IsInNonspecializedTemplate &&
335 !(ManglingContextDecl && isa(ManglingContextDecl))) ||
337 while (auto *CD = dyn_cast(DC))
340 }
341
342 return std::make_tuple(nullptr, nullptr);
343 }
344
346
347
348
349
350 case DataMember:
351
353
354 case InlineVariable:
355 case TemplatedVariable:
356
357 return std::make_tuple(
359 ManglingContextDecl),
360 ManglingContextDecl);
361 }
362
363 llvm_unreachable("unexpected context");
364}
365
370 assert(MethodTypeInfo && "expected a non null type");
371
373
374
375
376 if (Class->isDependentContext() || TemplateParams) {
379 if (Result->isUndeducedType()) {
383 }
384 }
385 return MethodType;
386}
387
388
389
390
391
392
393
394
398 return false;
401 return false;
403 return false;
404
411 if (LambdaType == ExplicitObjectParameterType)
412 return false;
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
429 if (!Inserted)
430 return It->second.empty();
431
433 CXXBasePaths Paths(true, true,
434 false);
436 Paths)) {
437 Diag(Param->getLocation(), diag::err_invalid_explicit_object_type_in_lambda)
438 << ExplicitObjectParameterType;
439 return true;
440 }
441
444 Diag(CallLoc, diag::err_explicit_object_lambda_ambiguous_base)
445 << LambdaType << PathsDisplay;
446 return true;
447 }
448
450 Paths.front(),
451 diag::err_explicit_object_lambda_inaccessible_base))
452 return true;
453
455 return false;
456}
457
460 std::optionalCXXRecordDecl::LambdaNumbering NumberingOverride) {
461 if (NumberingOverride) {
462 Class->setLambdaNumbering(*NumberingOverride);
463 return;
464 }
465
467
468 auto getMangleNumberingContext =
471
472 if (ManglingContextDecl)
475
476 auto DC = Class->getDeclContext();
477 while (auto *CD = dyn_cast(DC))
478 DC = CD->getParent();
480 };
481
488
489
490
491
492
493
494
495 MCtx = getMangleNumberingContext(Class, Numbering.ContextDecl);
496 assert(MCtx && "Retrieving mangle numbering context failed!");
498 }
499 if (MCtx) {
503 Class->setLambdaNumbering(Numbering);
504
505 if (auto *Source =
507 Source->AssignedLambdaNumbering(Class);
508 }
509}
510
513 bool ExplicitResultType) {
514 if (ExplicitResultType) {
519 diag::err_lambda_incomplete_result);
520 } else {
522 }
523}
524
529 bool ExplicitParams, bool Mutable) {
532 LSI->Lambda = LambdaClass;
534 LSI->ImpCaptureStyle = LambdaScopeInfo::ImpCap_LambdaByval;
535 else if (CaptureDefault == LCD_ByRef)
536 LSI->ImpCaptureStyle = LambdaScopeInfo::ImpCap_LambdaByref;
541}
542
545}
546
552 assert(LSI && "Expected a lambda scope");
554 "Already acted on explicit template parameters");
556 "Explicit template parameters should come "
557 "before invented (auto) ones");
558 assert(!TParams.empty() &&
559 "No template parameters to act on");
560 LSI->TemplateParams.append(TParams.begin(), TParams.end());
564}
565
566
567
568
569
570
571
572
574
575
577
578
579 if (DeclRefExpr *DRE = dyn_cast(E)) {
581 = dyn_cast(DRE->getDecl())) {
583 }
584 return nullptr;
585 }
586
587
588
590 if (BO->getOpcode() == BO_Comma)
592 return nullptr;
593 }
594
595
596
597 if (StmtExpr *SE = dyn_cast(E)) {
598 if (Expr *last = dyn_cast_or_null(SE->getSubStmt()->body_back()))
600 return nullptr;
601 }
602
603
604
605
609 return ED;
610 return nullptr;
611 }
612
613
614
615
617
618
619 if (ICE->getCastKind() == CK_IntegralCast)
621
622
623 }
624
625
627 return ET->getDecl();
628 }
629
630
631 return nullptr;
632}
633
634
635
639 return nullptr;
640}
641
642
643
644
647
648
650 if (!ED) return nullptr;
651
652
653 for (++i; i != e; ++i) {
655 return nullptr;
656 }
657
658
660
661 return ED;
662}
663
664
665
669 i = returns.begin(), e = returns.end(); i != e; ++i) {
673 continue;
674
675
678
679 ExprWithCleanups *cleanups = dyn_cast(retValue);
680
681 Expr *E = (cleanups ? cleanups->getSubExpr() : retValue);
685 if (cleanups) {
687 } else {
689 }
690 }
691}
692
695
698 "lambda expressions use auto deduction in C++14 onwards");
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
725 if (CSI.Returns.empty()) {
726
727
730 return;
731 }
732
733
734
735 assert(!CSI.ReturnType.isNull() && "We should have a tentative return type.");
737 return;
738
739
741 assert(isa(CSI));
743 if (ED) {
746 return;
747 }
748 }
749
750
751 if (CSI.Returns.size() == 1)
752 return;
753
754
755
756
757
758
759
762
767
768 auto RetTyNullability = ReturnType->getNullability();
770 if (BlockNullability &&
771 (!RetTyNullability ||
774 continue;
775 }
776
777
778
780 diag::err_typecheck_missing_return_type_incompatible)
781 << ReturnType << CSI.ReturnType << isa(CSI);
782
783 }
784}
785
789 bool IsDirectInit, Expr *&Init) {
790
791
796 if (ByRef) {
798 assert(!DeductType.isNull() && "can't build reference to auto");
800 }
801 if (EllipsisLoc.isValid()) {
802 if (Init->containsUnexpandedParameterPack()) {
804 ? diag::warn_cxx17_compat_init_capture_pack
805 : diag::ext_init_capture_pack);
807 false);
809 } else {
810
811
812 }
813 }
815
816
822
823
825
826
827
831 IsDirectInit
833 Loc, Init->getBeginLoc(), Init->getEndLoc())
836
838 if (CXXDirectInit)
839 Args =
844
845 if (Result.isInvalid())
847
850}
851
855
856
859 PETL.setEllipsisLoc(EllipsisLoc);
860
861
862
863
864
866 InitCaptureType, TSI, SC_Auto);
869
875 return NewVD;
876}
877
879 assert(Var->isInitCapture() && "init capture flag should be set");
880 LSI->addCapture(Var, false, ByRef,
882 Var->getType(), false);
883}
884
885
886
890}
891
894
895
896
898 false, true));
904
905
906
907
908
909
910
917}
918
922 bool &ExplicitResultType) {
923
924 ExplicitResultType = false;
925
926 assert(
930 "Unexpected storage specifier");
931 bool IsLambdaStatic =
933
935
938 } else {
939
941
943
944 bool HasExplicitObjectParameter =
946
949 !HasExplicitObjectParameter)
951
952 if (ExplicitResultType && S.getLangOpts().HLSL) {
954 if (!RetTy.isNull()) {
955
956
960 diag::err_return_value_with_address_space);
961 }
962 }
963
965 assert(MethodTyInfo && "no type from lambda-declarator");
966
967
971 }
972 return MethodTyInfo;
973}
974
977
978
979
980
981
982
983
991 MethodNameLoc),
995 nullptr);
997 return Method;
998}
999
1003 assert(TemplateParams && "no template parameters");
1006 TemplateParams, CallOperator);
1009}
1010
1016 bool HasExplicitResultType) {
1017
1019
1020 if (TrailingRequiresClause)
1022
1025
1027
1028
1030 if (TemplateParams) {
1033 assert(TemplateMethod &&
1034 "AddTemplateParametersToLambdaCallOperator should have been called");
1035
1038 } else {
1040 }
1043
1049 TemplateParams, MethodTyInfo));
1052 if (!Params.empty()) {
1056 assert(P && "null in a parameter list");
1057 P->setOwningFunction(Method);
1058 }
1059 }
1060
1062}
1063
1065 Scope *CurrentScope) {
1066
1068 assert(LSI && "LambdaScopeInfo should be on stack!");
1069
1071 LSI->ImpCaptureStyle = LambdaScopeInfo::ImpCap_LambdaByval;
1073 LSI->ImpCaptureStyle = LambdaScopeInfo::ImpCap_LambdaByref;
1077
1079
1080
1081
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097 while (P->getEntity() && P->getEntity()->isRequiresExprBody())
1099 if (P->isFunctionDeclarationScope() &&
1100 llvm::any_of(P->decls(), [](Decl *D) {
1101 return isa(D) &&
1102 cast(D)->getType()->isTemplateTypeParmType();
1103 }))
1105 }
1106
1108 Intro.Range, nullptr, LambdaDependencyKind, Intro.Default);
1110
1113
1114
1116
1118
1119 bool ContainsUnexpandedParameterPack = false;
1120
1121
1122 llvm::DenseMap<IdentifierInfo *, ValueDecl *> CaptureNames;
1123
1124
1128 PrevCaptureLoc = C->Loc, ++C) {
1132 ? diag::ext_star_this_lambda_capture_cxx17
1133 : diag::warn_cxx14_compat_star_this_lambda_capture);
1134
1135
1136
1137
1139 Diag(C->Loc, diag::err_capture_more_than_once)
1143 continue;
1144 }
1145
1146
1147
1148
1149
1150
1153 ? diag::ext_equals_this_lambda_capture_cxx20
1154 : diag::warn_cxx17_compat_equals_this_lambda_capture);
1155
1156
1157
1158
1160 if (ThisCaptureType.isNull()) {
1161 Diag(C->Loc, diag::err_this_capture) << true;
1162 continue;
1163 }
1164
1166 nullptr,
1170 continue;
1171 }
1172
1173 assert(C->Id && "missing identifier for capture");
1174
1175 if (C->Init.isInvalid())
1176 continue;
1177
1179 if (C->Init.isUsable()) {
1181 ? diag::warn_cxx11_compat_init_capture
1182 : diag::ext_init_capture);
1183
1184
1185
1186
1187
1188
1189 if (C->InitCaptureType.get().isNull())
1190 continue;
1191
1192 if (C->Init.get()->containsUnexpandedParameterPack() &&
1195
1196 unsigned InitStyle;
1197 switch (C->InitKind) {
1199 llvm_unreachable("not an init-capture?");
1202 break;
1205 break;
1208 break;
1209 }
1211 C->EllipsisLoc, C->Id, InitStyle,
1212 C->Init.get(), Method);
1213 assert(Var && "createLambdaInitCaptureVarDecl returned a null VarDecl?");
1214 if (auto *V = dyn_cast(Var))
1217 } else {
1219 "init capture has valid but null init?");
1220
1221
1222
1223
1224
1225
1227 Diag(C->Loc, diag::err_reference_capture_with_reference_default)
1230 continue;
1232 Diag(C->Loc, diag::err_copy_capture_with_copy_default)
1235 continue;
1236 }
1237
1238
1239
1240
1245 continue;
1246 if (R.empty()) {
1247
1251 continue;
1252 }
1253
1255 Var = BD;
1257 Diag(C->Loc, diag::err_capture_class_member_does_not_name_variable)
1258 << C->Id;
1259 continue;
1260 } else
1263 continue;
1264 }
1265
1266
1267
1268
1269
1270 if (!Var) {
1271 Diag(C->Loc, diag::err_capture_does_not_name_variable) << C->Id;
1272 continue;
1273 }
1274
1275
1276
1277
1278 if (auto [It, Inserted] = CaptureNames.insert(std::pair{C->Id, Var});
1279 !Inserted) {
1282 Diag(C->Loc, diag::err_capture_more_than_once)
1283 << C->Id << It->second->getBeginLoc()
1289 } else {
1290
1291
1292 Diag(C->Loc, diag::err_capture_more_than_once) << C->Id;
1293 continue;
1294 }
1295 }
1296
1297
1299 continue;
1300
1302
1304 Diag(C->Loc, diag::err_capture_non_automatic_variable) << C->Id;
1305 Diag(Var->getLocation(), diag::note_previous_decl) << C->Id;
1306 continue;
1307 }
1308
1309
1310
1312 if (C->EllipsisLoc.isValid()) {
1314 EllipsisLoc = C->EllipsisLoc;
1315 } else {
1316 Diag(C->EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
1317 << (C->Init.isUsable() ? C->Init.get()->getSourceRange()
1319
1320
1321 }
1323 ContainsUnexpandedParameterPack = true;
1324 }
1325
1326 if (C->Init.isUsable()) {
1328 } else {
1332 }
1335 }
1339}
1340
1343
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1363 false)))
1364 Diag(Intro.DefaultLoc, diag::err_capture_default_non_local);
1365}
1366
1371
1373 auto *Param = cast(P.Param);
1374 Param->setOwningFunction(LSI->CallOperator);
1375 if (Param->getIdentifier())
1377 }
1378
1379
1380
1381
1382
1385 if (TemplateParams) {
1387 TemplateParams);
1391 }
1393}
1394
1398
1401
1403 bool ExplicitResultType;
1404
1408 } else {
1409 unsigned Index;
1411 const auto &Object = ParamInfo.getTypeObject(Index);
1415 }
1416
1419
1421 *this, Intro, ParamInfo, getCurScope(), TypeLoc, ExplicitResultType);
1422
1424
1428 Params.reserve(Params.size());
1429 for (unsigned I = 0; I < FTI.NumParams; ++I) {
1430 auto *Param = cast(FTI.Params[I].Param);
1431 Param->setScopeInfo(0, Params.size());
1432 Params.push_back(Param);
1433 }
1434 }
1435
1436 bool IsLambdaStatic =
1438
1440 Method, Intro.Range.getBegin(), CallOperatorLoc,
1443 IsLambdaStatic ? SC_Static : SC_None, Params, ExplicitResultType);
1444
1446
1447
1448
1450
1451
1453 Method, true))
1455
1456
1458
1461
1462
1465
1466
1469
1471
1472 for (auto &&C : LSI->Captures) {
1473 if (.isVariableCapture())
1474 continue;
1478 }
1479 }
1480
1481 auto CheckRedefinition = [&](ParmVarDecl *Param) {
1483 if (Capture.Id == Param->getIdentifier()) {
1484 Diag(Param->getLocation(), diag::err_parameter_shadow_capture);
1485 Diag(Capture.Loc, diag::note_var_explicitly_captured_here)
1487 return false;
1488 }
1489 }
1490 return true;
1491 };
1492
1494 if (->getIdentifier())
1495 continue;
1496 if (CheckRedefinition(P))
1499 }
1500
1501
1502
1503
1504
1505
1508 if (TemplateParams) {
1509 for (const auto *TP : TemplateParams->asArray()) {
1510 if (!TP->getIdentifier())
1511 continue;
1513 if (Capture.Id == TP->getIdentifier()) {
1516 }
1517 }
1518 }
1519 }
1520
1521
1522
1523
1524
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1548 Diag(TRC->getBeginLoc(), diag::err_constrained_non_templated_function);
1549 }
1550 }
1551
1552
1553
1560 ExprEvalContexts.back().InImmediateEscalatingFunctionContext =
1562}
1563
1565 bool IsInstantiation) {
1567
1568
1571
1572
1573 if (!IsInstantiation)
1575
1576
1578 Class->setInvalidDecl();
1583
1585}
1586
1587template
1591 CallOpProto.isVariadic(), false);
1593 CallOpProto.isVariadic(), true);
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1611 DefaultFree, DefaultMember, CallOpCC};
1612 llvm::sort(Convs);
1613 llvm::iterator_range<CallingConv *> Range(
1614 std::begin(Convs), std::unique(std::begin(Convs), std::end(Convs)));
1616
1619 F(C);
1620 }
1621 return;
1622 }
1623
1624 if (CallOpCC == DefaultMember && DefaultMember != DefaultFree) {
1625 F(DefaultFree);
1626 F(DefaultMember);
1627 } else {
1628 F(CallOpCC);
1629 }
1630}
1631
1632
1633
1634
1639 CallOpProto->isVariadic(), false);
1641 CallOpProto->isVariadic(), true);
1643
1644
1645
1646 if (CallOpCC == DefaultMember && DefaultMember != DefaultFree)
1647 return DefaultFree;
1648 return CallOpCC;
1649}
1650
1659 "Lambda's call operator should not have a reference qualifier");
1662}
1663
1664
1665
1669 QualType InvokerFunctionTy) {
1670
1671
1672 auto HasPassObjectSizeAttr = [](const ParmVarDecl *P) {
1673 return P->hasAttr();
1674 };
1675 if (llvm::any_of(CallOperator->parameters(), HasPassObjectSizeAttr))
1676 return;
1677
1678
1680
1681
1684 false, true));
1685
1690
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1715
1716
1720
1723
1724
1727
1728
1729
1734
1735
1736
1737
1738
1739
1740
1741
1742
1744 for (unsigned I = 0, N = CallOperator->getNumParams(); I != N; ++I) {
1746
1749
1753 nullptr));
1754 CallOpConvTL.setParam(I, From);
1755 CallOpConvNameTL.setParam(I, From);
1756 }
1757
1768
1769
1770
1773
1774 if (Class->isGenericLambda()) {
1775
1776
1781 Loc, ConversionName,
1783 Conversion);
1787 Class->addDecl(ConversionTemplate);
1788 } else
1789 Class->addDecl(Conversion);
1790
1791
1792
1793
1794
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1815 for (unsigned I = 0, N = CallOperator->getNumParams(); I != N; ++I)
1816 InvokerParams[I]->setOwningFunction(Invoke);
1817 Invoke->setParams(InvokerParams);
1820 if (Class->isGenericLambda()) {
1828 StaticInvokerTemplate->setImplicit(true);
1830 Class->addDecl(StaticInvokerTemplate);
1831 } else
1832 Class->addDecl(Invoke);
1833 }
1834}
1835
1836
1837
1838
1839
1845
1848 QualType InvokerFunctionTy =
1851 InvokerFunctionTy);
1852 });
1853}
1854
1855
1865
1868 false, true));
1872
1887 Class->addDecl(Conversion);
1888}
1889
1892 bool IsOpenMPMapping) {
1893
1896
1897
1899 return cast(Cap.getVariable())->getInit();
1900
1901
1902
1903
1905 ImplicitCaptureLoc.isValid() ? ImplicitCaptureLoc : Cap.getLocation();
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1926 else
1927 Init = This;
1928 } else {
1934 }
1935
1936
1937
1938
1939 if (IsOpenMPMapping)
1940 return Init;
1941
1942 if (Init.isInvalid())
1944
1945 Expr *InitExpr = Init.get();
1951 return InitSeq.Perform(*this, Entity, InitKind, InitExpr);
1952}
1953
1956
1959
1961
1963}
1964
1967 switch (ICS) {
1976 llvm_unreachable("block capture in lambda");
1977 }
1978 llvm_unreachable("Unknown implicit capture style");
1979}
1980
1985 return true;
1986 }
1987
1989 return false;
1990
1994
1995 if (T.isVolatileQualified())
1996 return true;
1997
2000 return !RD->isCompleteDefinition() || !RD->hasTrivialCopyConstructor() ||
2001 !RD->hasTrivialDestructor();
2002
2003 return false;
2004}
2005
2009 return false;
2010
2012 return false;
2013
2014
2015
2018 return false;
2019
2020 auto diag = Diag(From.getLocation(), diag::warn_unused_lambda_capture);
2022 diag << "'this'";
2023 else
2027 return true;
2028}
2029
2030
2031
2036
2040 if (Var && Var->isInitCapture())
2041 TSI = Var->getTypeSourceInfo();
2042 }
2043
2044
2045
2046 if (!TSI)
2048
2049
2052 nullptr, FieldType, TSI, nullptr,
2054
2055
2058 diag::err_field_incomplete_or_sizeless)) {
2060 Field->setInvalidDecl();
2061 } else {
2066 Field->setInvalidDecl();
2067 }
2068 }
2069 }
2070 Field->setImplicit(true);
2073
2076
2077 return Field;
2078}
2079
2082
2091 bool ExplicitParams;
2092 bool ExplicitResultType;
2094 bool ContainsUnexpandedParameterPack;
2095 bool IsGenericLambda;
2096 {
2102 LambdaCleanup = LSI->Cleanup;
2104 IsGenericLambda = Class->isGenericLambda();
2105
2107 Decl *TemplateOrNonTemplateCallOperatorDecl =
2110 : cast(CallOperator);
2111
2112
2113
2115
2117
2118
2119 bool CurHasPreviousCapture = CaptureDefault != LCD_None;
2120 SourceLocation PrevCaptureLoc = CurHasPreviousCapture ?
2121 CaptureDefaultLoc : IntroducerRange.getBegin();
2122
2123 for (unsigned I = 0, N = LSI->Captures.size(); I != N; ++I) {
2125
2128
2129 assert(!From.isBlockCapture() && "Cannot capture __block variables");
2133
2134
2136
2137
2138 bool IsCaptureUsed = true;
2141
2142
2143 bool NonODRUsedInitCapture =
2145 if (!NonODRUsedInitCapture) {
2149 if (!CurHasPreviousCapture && !IsLast) {
2150
2151
2154 } else {
2155
2157 CaptureRange.getEnd());
2158 }
2159 }
2160
2162 }
2163 }
2164
2165 if (CaptureRange.isValid()) {
2166 CurHasPreviousCapture |= IsCaptureUsed;
2167 PrevCaptureLoc = CaptureRange.getEnd();
2168 }
2169
2170
2173
2174
2175
2178 Diag(From.getLocation(), diag::warn_deprecated_this_capture);
2179 Diag(CaptureDefaultLoc, diag::note_deprecated_this_capture)
2182 }
2187 } else {
2194 }
2195 }();
2196
2197
2199
2200
2201
2202
2203
2204
2206 Captures.push_back(Capture);
2207 CaptureInits.push_back(Init.get());
2208
2211 }
2212
2214
2215
2216
2217
2218
2219
2220 if (Captures.empty() && CaptureDefault == LCD_None)
2222 CallOperator);
2223
2224
2225
2226
2227
2228
2229
2232
2233
2238 }
2239
2241
2243 CaptureDefault, CaptureDefaultLoc,
2244 ExplicitParams, ExplicitResultType,
2245 CaptureInits, EndLoc,
2246 ContainsUnexpandedParameterPack);
2247
2248
2249
2252 !isa(CallOperator->getBody()) &&
2253 ->getDeclContext()->isDependentContext()) {
2259 }
2260
2261
2263
2266
2267
2268
2272
2273
2274
2275
2276
2277
2278
2279
2280
2283
2284
2285
2287 break;
2288
2292 break;
2293 }
2295 }
2296
2298}
2299
2303 Expr *Src) {
2304
2307 = cast(
2312
2315 CurrentLocation, Src);
2316 if (.isInvalid())
2318
2319 if (Init.isInvalid())
2321
2322
2324
2325
2328 Block->setBlockMissingReturnType(false);
2329
2330
2332 for (unsigned I = 0, N = CallOperator->getNumParams(); I != N; ++I) {
2338 nullptr));
2339 }
2340 Block->setParams(BlockParams);
2341
2342 Block->setIsConversionFromLambda(true);
2343
2344
2345
2346
2350 ConvLocation, nullptr,
2351 Src->getType(), CapVarTSI,
2354 false, Init.get());
2356
2357
2358
2360
2361
2362
2363 Expr *BuildBlock =
2365 false);
2368
2369 return BuildBlock;
2370}
2371
2376 return FD;
2377 }
2378
2381
2383 if (!FTD)
2384 return nullptr;
2385
2388
2390}
2391
2399 return;
2400 }
2401
2403
2405 if (!FDPattern)
2406 return;
2407
2408 if (!ShouldAddDeclsFromParentScope)
2409 return;
2410
2411 FunctionDecl *InnermostFD = FD, *InnermostFDPattern = FDPattern;
2413 ParentInstantiations;
2414 while (true) {
2415 FDPattern =
2418
2419 if (!FDPattern || !FD)
2420 break;
2421
2422 ParentInstantiations.emplace_back(FDPattern, FD);
2423 }
2424
2425
2426
2427
2428
2429
2430
2431
2432 for (const auto &[FDPattern, FD] : llvm::reverse(ParentInstantiations)) {
2433 SemaRef.addInstantiatedParametersToScope(FD, FDPattern, Scope, MLTAL);
2434 SemaRef.addInstantiatedLocalVarsToScope(FD, FDPattern, Scope);
2435
2437 SemaRef.addInstantiatedCapturesToScope(FD, FDPattern, Scope, MLTAL);
2438 }
2439
2440 SemaRef.addInstantiatedCapturesToScope(InnermostFD, InnermostFDPattern, Scope,
2441 MLTAL);
2442}
This file provides some common utility functions for processing Lambda related AST Constructs.
Defines the clang::Expr interface and subclasses for C++ expressions.
This file declares semantic analysis functions specific to ARM.
This file declares semantic analysis for CUDA constructs.
static LambdaCaptureDefault mapImplicitCaptureStyle(CapturingScopeInfo::ImplicitCaptureStyle ICS)
static CallingConv getLambdaConversionFunctionCallConv(Sema &S, const FunctionProtoType *CallOpProto)
static EnumDecl * findEnumForBlockReturn(Expr *E)
If this expression is an enumerator-like expression of some type T, return the type T; otherwise,...
static EnumDecl * findCommonEnumForBlockReturns(ArrayRef< ReturnStmt * > returns)
Attempt to find a common type T for which all of the returned expressions in a block are enumerator-l...
static TypeSourceInfo * getLambdaType(Sema &S, LambdaIntroducer &Intro, Declarator &ParamInfo, Scope *CurScope, SourceLocation Loc, bool &ExplicitResultType)
static std::optional< unsigned > getStackIndexOfNearestEnclosingCaptureReadyLambda(ArrayRef< const clang::sema::FunctionScopeInfo * > FunctionScopes, ValueDecl *VarToCapture)
Examines the FunctionScopeInfo stack to determine the nearest enclosing lambda (to the current lambda...
static FunctionDecl * getPatternFunctionDecl(FunctionDecl *FD)
static LambdaScopeInfo * getCurrentLambdaScopeUnsafe(Sema &S)
static void adjustBlockReturnsToEnum(Sema &S, ArrayRef< ReturnStmt * > returns, QualType returnType)
Adjust the given return statements so that they formally return the given type.
static TemplateParameterList * getGenericLambdaTemplateParameterList(LambdaScopeInfo *LSI, Sema &SemaRef)
static void addBlockPointerConversion(Sema &S, SourceRange IntroducerRange, CXXRecordDecl *Class, CXXMethodDecl *CallOperator)
Add a lambda's conversion to block pointer.
static void buildLambdaScopeReturnType(Sema &S, LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator, bool ExplicitResultType)
static TypeSourceInfo * getDummyLambdaType(Sema &S, SourceLocation Loc=SourceLocation())
static QualType buildTypeForLambdaCallOperator(Sema &S, clang::CXXRecordDecl *Class, TemplateParameterList *TemplateParams, TypeSourceInfo *MethodTypeInfo)
static bool isInInlineFunction(const DeclContext *DC)
Determine whether the given context is or is enclosed in an inline function.
static void addFunctionPointerConversions(Sema &S, SourceRange IntroducerRange, CXXRecordDecl *Class, CXXMethodDecl *CallOperator)
Add a lambda's conversion to function pointers, as described in C++11 [expr.prim.lambda]p6.
static void repeatForLambdaConversionFunctionCallingConvs(Sema &S, const FunctionProtoType &CallOpProto, Func F)
static void addFunctionPointerConversion(Sema &S, SourceRange IntroducerRange, CXXRecordDecl *Class, CXXMethodDecl *CallOperator, QualType InvokerFunctionTy)
Add a lambda's conversion to function pointer, as described in C++11 [expr.prim.lambda]p6.
This file provides some common utility functions for processing Lambdas.
This file declares semantic analysis for OpenMP constructs and clauses.
This file declares semantic analysis for SYCL constructs.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
CanQualType getCanonicalFunctionResultType(QualType ResultType) const
Adjust the given function result type.
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
DeclarationNameTable DeclarationNames
QualType getRecordType(const RecordDecl *Decl) const
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod, bool IsBuiltin=false) const
Retrieves the default calling convention for the current target.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
llvm::DenseMap< const CXXMethodDecl *, CXXCastPath > LambdaCastPaths
For capturing lambdas with an explicit object parameter whose type is derived from the lambda type,...
MangleNumberingContext & getManglingNumberContext(const DeclContext *DC)
Retrieve the context for computing mangling numbers in the given DeclContext.
QualType getPackExpansionType(QualType Pattern, std::optional< unsigned > NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
const TargetInfo & getTargetInfo() const
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
Attr - This represents one attribute.
A builtin binary operation expression such as "x + y" or "x <= y".
A binding in a decomposition declaration.
A class which contains all the information about a particular captured value.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
static BlockDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
Represents a C++ conversion function within a class.
static CXXConversionDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, bool UsesFPIntrin, bool isInline, ExplicitSpecifier ES, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
QualType getConversionType() const
Returns the type that this conversion function is converting to.
Represents a static or instance method of a struct/union/class.
bool isImplicitObjectMemberFunction() const
[C++2b][dcl.fct]/p7 An implicit object member function is a non-static member function without an exp...
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
static CXXMethodDecl * Create(ASTContext &C, CXXRecordDecl *RD, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool UsesFPIntrin, bool isInline, ConstexprSpecKind ConstexprKind, SourceLocation EndLocation, Expr *TrailingRequiresClause=nullptr)
Represents a C++ struct/union/class.
void setLambdaTypeInfo(TypeSourceInfo *TS)
void setLambdaIsGeneric(bool IsGeneric)
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, unsigned DependencyKind, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
bool isCapturelessLambda() const
Represents a C++ nested-name-specifier or a global scope specifier.
void mergeFrom(CleanupInfo Rhs)
void setExprNeedsCleanups(bool SideEffects)
CompoundStmt - This represents a group of statements like { stmt stmt }.
ConditionalOperator - The ?: ternary operator.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC.
bool isFileContext() const
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
bool isTranslationUnit() const
void addDecl(Decl *D)
Add the declaration D into this context.
bool isFunctionOrMethod() const
Simple template class for restricting typo correction candidates to ones having a single Decl* of the...
A reference to a declared variable, function, enum, etc.
Captures information about "declaration specifiers".
SCS getStorageClassSpec() const
bool SetTypeQual(TQ T, SourceLocation Loc)
ConstexprSpecKind getConstexprSpecifier() const
Decl - This represents one declaration (or definition), e.g.
bool isParameterPack() const
Whether this declaration is a parameter pack.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
void markUsed(ASTContext &C)
Mark the declaration used, in the sense of odr-use.
bool isTemplated() const
Determine whether this declaration is a templated entity (whether it is.
bool isInvalidDecl() const
void setAccess(AccessSpecifier AS)
SourceLocation getLocation() const
void setImplicit(bool I=true)
void setReferenced(bool R=true)
void setLocation(SourceLocation L)
DeclContext * getDeclContext()
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
void setLexicalDeclContext(DeclContext *DC)
DeclarationNameLoc - Additional source/type location info for a declaration name.
static DeclarationNameLoc makeNamedTypeLoc(TypeSourceInfo *TInfo)
Construct location information for a constructor, destructor or conversion operator.
static DeclarationNameLoc makeCXXOperatorNameLoc(SourceLocation BeginLoc, SourceLocation EndLoc)
Construct location information for a non-literal C++ operator.
The name of a declaration.
void setInnerLocStart(SourceLocation L)
SourceLocation getBeginLoc() const LLVM_READONLY
void setTypeSourceInfo(TypeSourceInfo *TI)
void setTrailingRequiresClause(Expr *TrailingRequiresClause)
Expr * getTrailingRequiresClause()
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
bool isFunctionDeclarator(unsigned &idx) const
isFunctionDeclarator - This method returns true if the declarator is a function declarator (looking t...
const DeclaratorChunk & getTypeObject(unsigned i) const
Return the specified TypeInfo from this declarator.
const DeclSpec & getDeclSpec() const
getDeclSpec - Return the declaration-specifier that this declarator was declared with.
Expr * getTrailingRequiresClause()
Sets a trailing requires clause for this declarator.
unsigned getNumTypeObjects() const
Return the number of types applied to this declarator.
bool isExplicitObjectMemberFunction()
SourceRange getSourceRange() const LLVM_READONLY
Get the source range that spans this declarator.
DeclaratorChunk::FunctionTypeInfo & getFunctionTypeInfo()
getFunctionTypeInfo - Retrieves the function type info object (looking through parentheses).
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
An instance of this object exists for each enum constant that is defined.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
Store information needed for an explicit specifier.
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
This represents one expression.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
Represents difference between two FPOptions values.
bool isFPConstrained() const
Represents a member of a struct/union/class.
static FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
void setSubExpr(Expr *E)
As with any mutator of the AST, be very careful when modifying an existing AST to preserve its invari...
const Expr * getSubExpr() const
Represents a function declaration or definition.
const ParmVarDecl * getParamDecl(unsigned i) const
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
ConstexprSpecKind getConstexprKind() const
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
QualType getReturnType() const
ArrayRef< ParmVarDecl * > parameters() const
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
bool isVariadic() const
Whether this function is variadic.
@ TK_MemberSpecialization
@ TK_DependentNonTemplate
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
bool isImmediateEscalating() const
FunctionDecl * getInstantiatedFromDecl() const
void setConstexprKind(ConstexprSpecKind CSK)
void setStorageClass(StorageClass SClass)
Sets the storage class as written in the source.
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization,...
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
void setParams(ArrayRef< ParmVarDecl * > NewParamInfo)
Represents a prototype with parameter type info, e.g.
bool isVariadic() const
Whether this function prototype is variadic.
ExtProtoInfo getExtProtoInfo() const
ArrayRef< QualType > getParamTypes() const
Declaration of a template function.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
FunctionTemplateDecl * getInstantiatedFromMemberTemplate() const
static FunctionTemplateDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, DeclarationName Name, TemplateParameterList *Params, NamedDecl *Decl)
Create a function template node.
TypeLoc getReturnLoc() const
ExtInfo withCallingConv(CallingConv cc) const
CallingConv getCallConv() const
QualType getReturnType() const
One of these records is kept for each identifier that is lexed.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat, FPOptionsOverride FPO)
Describes the kind of initialization being performed, along with location information for tokens rela...
static InitializationKind CreateDirect(SourceLocation InitLoc, SourceLocation LParenLoc, SourceLocation RParenLoc)
Create a direct initialization.
static InitializationKind CreateCopy(SourceLocation InitLoc, SourceLocation EqualLoc, bool AllowExplicitConvs=false)
Create a copy initialization.
static InitializationKind CreateDirectList(SourceLocation InitLoc)
Describes the sequence of initializations required to initialize a given object or reference with a s...
ExprResult Perform(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, QualType *ResultType=nullptr)
Perform the actual initialization of the given entity based on the computed initialization sequence.
Describes an entity that is being initialized.
static InitializedEntity InitializeLambdaToBlock(SourceLocation BlockVarLoc, QualType Type)
static InitializedEntity InitializeLambdaCapture(IdentifierInfo *VarID, QualType FieldType, SourceLocation Loc)
Create the initialization entity for a lambda capture.
Describes the capture of a variable or of this, or of a C++1y init-capture.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
static LambdaExpr * Create(const ASTContext &C, CXXRecordDecl *Class, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, bool ExplicitParams, bool ExplicitResultType, ArrayRef< Expr * > CaptureInits, SourceLocation ClosingBrace, bool ContainsUnexpandedParameterPack)
Construct a new lambda expression.
A stack-allocated class that identifies which local variable declaration instantiations are present i...
Represents the results of name lookup.
DeclClass * getAsSingle() const
bool empty() const
Return true if no decls were found.
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
virtual unsigned getManglingNumber(const CXXMethodDecl *CallOperator)=0
Retrieve the mangling number of a new lambda expression with the given call operator within this cont...
unsigned getNextLambdaIndex()
virtual unsigned getDeviceManglingNumber(const CXXMethodDecl *)
Retrieve the mangling number of a new lambda expression with the given call operator within the devic...
Data structure that captures multiple levels of template argument lists for use in template instantia...
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
bool isPlaceholderVar(const LangOptions &LangOpts) const
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents a pack expansion of types.
unsigned getNumExprs() const
Return the number of expressions in this paren list.
Represents a parameter to a function.
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
Wrapper for source info for pointers.
A (possibly-)qualified type.
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
LangAS getAddressSpace() const
Return the address space of this type.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
The collection of all-type qualifiers we support.
void addAddressSpace(LangAS space)
Represents a struct/union/class.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
void setRetValue(Expr *E)
SourceLocation getBeginLoc() const
Scope - A scope is a transient data structure that is used while parsing the program.
const Scope * getParent() const
getParent - Return the scope that this is nested in.
Scope * getTemplateParamParent()
void CheckSMEFunctionDefAttributes(const FunctionDecl *FD)
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
void CheckLambdaCapture(CXXMethodDecl *D, const sema::Capture &Capture)
void SetLambdaAttrs(CXXMethodDecl *Method)
Set device or host device attributes on the given lambda operator() method.
void ActOnFinishedFunctionDefinitionInOpenMPAssumeScope(Decl *D)
Act on D, a function definition inside of an omp [begin/end] assumes.
void CheckSYCLEntryPointFunctionDecl(FunctionDecl *FD)
LambdaScopeForCallOperatorInstantiationRAII(Sema &SemasRef, FunctionDecl *FD, MultiLevelTemplateArgumentList MLTAL, LocalInstantiationScope &Scope, bool ShouldAddDeclsFromParentScope=true)
Sema - This implements semantic analysis and AST building for C.
Attr * getImplicitCodeSegOrSectionAttrForFunction(const FunctionDecl *FD, bool IsDefinition)
Returns an implicit CodeSegAttr if a __declspec(code_seg) is found on a containing class.
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
ExprResult BuildBlockForLambdaConversion(SourceLocation CurrentLocation, SourceLocation ConvLocation, CXXConversionDecl *Conv, Expr *Src)
Scope * getCurScope() const
Retrieve the parser's current scope.
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr, bool IsAfterAmp=false)
void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath)
bool RequireCompleteSizedType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
QualType deduceVarTypeFromInitializer(VarDecl *VDecl, DeclarationName Name, QualType Type, TypeSourceInfo *TSI, SourceRange Range, bool DirectInit, Expr *Init)
bool DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, CorrectionCandidateCallback &CCC, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, ArrayRef< Expr * > Args={}, DeclContext *LookupCtx=nullptr, TypoExpr **Out=nullptr)
Diagnose an empty lookup.
VarDecl * createLambdaInitCaptureVarDecl(SourceLocation Loc, QualType InitCaptureType, SourceLocation EllipsisLoc, IdentifierInfo *Id, unsigned InitStyle, Expr *Init, DeclContext *DeclCtx)
Create a dummy variable within the declcontext of the lambda's call operator, for name lookup purpose...
ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body)
ActOnLambdaExpr - This is called when the body of a lambda expression was successfully completed.
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, sema::LambdaScopeInfo *LSI)
Complete a lambda-expression having processed and attached the lambda body.
CXXRecordDecl * createLambdaClosureType(SourceRange IntroducerRange, TypeSourceInfo *Info, unsigned LambdaDependencyKind, LambdaCaptureDefault CaptureDefault)
Create a new lambda closure type.
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, ExpressionEvaluationContextRecord::ExpressionKind Type=ExpressionEvaluationContextRecord::EK_Other)
SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes
Stack containing information about each of the nested function, block, and method scopes that are cur...
PoppedFunctionScopePtr PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP=nullptr, const Decl *D=nullptr, QualType BlockType=QualType())
Pop a function (or block or lambda or captured region) scope from the stack.
bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit=false, bool BuildAndDiagnose=true, const unsigned *const FunctionScopeIndexToStopAt=nullptr, bool ByCopy=false)
Make sure the value of 'this' is actually available in the current context, if it is a potentially ev...
void ActOnLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro, Scope *CurContext)
Once the Lambdas capture are known, we can start to create the closure, call operator method,...
void AddTemplateParametersToLambdaCallOperator(CXXMethodDecl *CallOperator, CXXRecordDecl *Class, TemplateParameterList *TemplateParams)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
void AddRangeBasedOptnone(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based o...
void addInitCapture(sema::LambdaScopeInfo *LSI, VarDecl *Var, bool ByRef)
Add an init-capture to a lambda scope.
FieldDecl * BuildCaptureField(RecordDecl *RD, const sema::Capture &Capture)
Build a FieldDecl suitable to hold the given capture.
sema::LambdaScopeInfo * RebuildLambdaScopeInfo(CXXMethodDecl *CallOperator)
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
ASTContext & getASTContext() const
bool tryCaptureVariable(ValueDecl *Var, SourceLocation Loc, TryCaptureKind Kind, SourceLocation EllipsisLoc, bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const unsigned *const FunctionScopeIndexToStopAt)
Try to capture the given variable.
void PopExpressionEvaluationContext()
std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths)
Builds a string representing ambiguous paths from a specific derived class to different subobjects of...
sema::LambdaScopeInfo * getCurGenericLambda()
Retrieve the current generic lambda info, if any.
void handleLambdaNumbering(CXXRecordDecl *Class, CXXMethodDecl *Method, std::optional< CXXRecordDecl::LambdaNumbering > NumberingOverride=std::nullopt)
Number lambda for linkage purposes if necessary.
LangAS getDefaultCXXMethodAddrSpace() const
Returns default addr space for method qualifiers.
ExprResult BuildCaptureInit(const sema::Capture &Capture, SourceLocation ImplicitCaptureLoc, bool IsOpenMPMapping=false)
Initialize the given capture with a suitable expression.
FPOptions & getCurFPFeatures()
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
@ UPPC_Initializer
An initializer.
@ UPPC_DeclarationType
The type of an arbitrary declaration.
void buildLambdaScope(sema::LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, bool ExplicitParams, bool Mutable)
Endow the lambda scope info with the relevant properties.
const LangOptions & getLangOpts() const
bool CaptureHasSideEffects(const sema::Capture &From)
Does copying/destroying the captured variable have side effects?
void ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, Declarator &ParamInfo, const DeclSpec &DS)
ActOnStartOfLambdaDefinition - This is called just before we start parsing the body of a lambda; it a...
void ActOnLambdaClosureParameters(Scope *LambdaScope, MutableArrayRef< DeclaratorChunk::ParamInfo > ParamInfo)
bool CheckConstexprFunctionDefinition(const FunctionDecl *FD, CheckConstexprKind Kind)
AccessResult CheckBaseClassAccess(SourceLocation AccessLoc, QualType Base, QualType Derived, const CXXBasePath &Path, unsigned DiagID, bool ForceCheck=false, bool ForceUnprivileged=false)
Checks access for a hierarchy conversion.
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
const LangOptions & LangOpts
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
bool DiagnoseUnusedLambdaCapture(SourceRange CaptureRange, const sema::Capture &From)
Diagnose if an explicit lambda capture is unused.
void maybeAddDeclWithEffects(FuncOrBlockDecl *D)
Inline checks from the start of maybeAddDeclWithEffects, to minimize performance impact on code not u...
QualType buildLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc, std::optional< unsigned > NumExpansions, IdentifierInfo *Id, bool DirectInit, Expr *&Init)
void CheckCXXDefaultArguments(FunctionDecl *FD)
Helpers for dealing with blocks and functions.
CleanupInfo Cleanup
Used to control the generation of ExprWithCleanups.
void DiagnoseShadowingLambdaDecls(const sema::LambdaScopeInfo *LSI)
Diagnose shadowing for variables shadowed in the lambda record LambdaRD when these variables are capt...
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
void DiagPlaceholderVariableDefinition(SourceLocation Loc)
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
@ TryCapture_ExplicitByVal
@ TryCapture_ExplicitByRef
void ActOnLambdaExplicitTemplateParameterList(LambdaIntroducer &Intro, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > TParams, SourceLocation RAngleLoc, ExprResult RequiresClause)
This is called after parsing the explicit template parameter list on a lambda (if it exists) in C++2a...
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
void ActOnLambdaClosureQualifiers(LambdaIntroducer &Intro, SourceLocation MutableLoc)
void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope, bool IsInstantiation=false)
ActOnLambdaError - If there is an error parsing a lambda, this callback is invoked to pop the informa...
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr, bool SkipTrailingRequiresClause=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
bool CheckParmsForFunctionDef(ArrayRef< ParmVarDecl * > Parameters, bool CheckParameterNames)
CheckParmsForFunctionDef - Check that the parameters of the given function are appropriate for the de...
void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, const LookupResult &R)
Diagnose variable or built-in function shadowing.
@ Normal
A normal translation unit fragment.
SmallVector< ExprWithCleanups::CleanupObject, 8 > ExprCleanupObjects
ExprCleanupObjects - This is the stack of objects requiring cleanup that are created by the current f...
@ UnevaluatedAbstract
The current expression occurs within an unevaluated operand that unconditionally permits abstract ref...
@ UnevaluatedList
The current expression occurs within a braced-init-list within an unevaluated operand.
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ DiscardedStatement
The current expression occurs within a discarded statement.
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
@ PotentiallyEvaluatedIfUsed
The current expression is potentially evaluated, but any declarations referenced inside that expressi...
TypeSourceInfo * GetTypeForDeclarator(Declarator &D)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl, ArrayRef< Decl * > Fields, SourceLocation LBrac, SourceLocation RBrac, const ParsedAttributesView &AttrList)
void CheckExplicitObjectLambda(Declarator &D)
QualType getLambdaConversionFunctionResultType(const FunctionProtoType *CallOpType, CallingConv CC)
Get the return type to use for a lambda's conversion function(s) to function pointer type,...
void CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record)
Perform semantic checks on a class definition that has been completing, introducing implicitly-declar...
void DiscardCleanupsInEvaluationContext()
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
CXXMethodDecl * CreateLambdaCallOperator(SourceRange IntroducerRange, CXXRecordDecl *Class)
void deduceClosureReturnType(sema::CapturingScopeInfo &CSI)
Deduce a block or lambda's return type based on the return statements present in the body.
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
ProcessDeclAttributes - Given a declarator (PD) with attributes indicated in it, apply them to D.
QualType SubstAutoTypeDependent(QualType TypeWithAuto)
std::tuple< MangleNumberingContext *, Decl * > getCurrentMangleNumberContext(const DeclContext *DC)
Compute the mangling number context for a lambda expression or block literal.
void CompleteLambdaCallOperator(CXXMethodDecl *Method, SourceLocation LambdaLoc, SourceLocation CallOperatorLoc, Expr *TrailingRequiresClause, TypeSourceInfo *MethodTyInfo, ConstexprSpecKind ConstexprKind, StorageClass SC, ArrayRef< ParmVarDecl * > Params, bool HasExplicitResultType)
void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI)
Note that we have finished the explicit captures for the given lambda.
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
@ CheckValid
Identify whether this function satisfies the formal rules for constexpr functions in the current lanu...
bool DiagnoseInvalidExplicitObjectParameterInLambda(CXXMethodDecl *Method, SourceLocation CallLoc)
Returns true if the explicit object parameter was invalid.
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
void NoteTemplateParameterLocation(const NamedDecl &Decl)
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
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
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
bool hasNameForLinkage() const
Is this tag type named, either directly or via being defined in a typedef of this type?
Exposes information about the current target.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
virtual CallingConvCheckResult checkCallingConvention(CallingConv CC) const
Determines whether a given calling convention is valid for the target.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Stores a list of template parameters for a TemplateDecl and its derived classes.
bool containsUnexpandedParameterPack() const
Determine whether this template parameter list contains an unexpanded parameter pack.
ArrayRef< NamedDecl * > asArray()
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
void setNameLoc(SourceLocation Loc)
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
CanQualType getCanonicalTypeUnqualified() const
const T * castAs() const
Member-template castAs.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
bool isUndeducedType() const
Determine whether this type is an undeduced type, meaning that it somehow involves a C++11 'auto' typ...
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
const T * getAs() const
Member-template getAs'.
std::optional< NullabilityKind > getNullability() const
Determine the nullability of the given type.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
void setType(QualType newType)
VarDecl * getPotentiallyDecomposedVarDecl()
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
Represents a variable declaration or definition.
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
void setInitStyle(InitializationStyle Style)
void setInitCapture(bool IC)
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
InitializationStyle
Initialization styles.
@ ListInit
Direct list-initialization (C++11)
@ CInit
C-style initialization with assignment.
@ CallInit
Call-style initialization (C++98)
bool hasLocalStorage() const
Returns true if a variable with function scope is a non-static local variable.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
bool isParameterPack() const
Determine whether this variable is actually a function parameter pack or init-capture pack.
ValueDecl * getVariable() const
bool isVariableCapture() const
bool isBlockCapture() const
SourceLocation getLocation() const
Retrieve the location at which this variable was captured.
bool isNonODRUsed() const
bool isInitCapture() const
Determine whether this capture is an init-capture.
bool isVLATypeCapture() const
SourceLocation getEllipsisLoc() const
Retrieve the source location of the ellipsis, whose presence indicates that the capture is a pack exp...
bool isThisCapture() const
QualType getCaptureType() const
Retrieve the capture type for this capture, which is effectively the type of the non-static data memb...
bool isCopyCapture() const
const VariableArrayType * getCapturedVLAType() const
QualType ReturnType
ReturnType - The target type of return statements in this context, or null if unknown.
bool isCaptured(ValueDecl *Var) const
Determine whether the given variable has been captured.
bool ContainsUnexpandedParameterPack
Whether this contains an unexpanded parameter pack.
SmallVector< Capture, 4 > Captures
Captures - The captures.
ImplicitCaptureStyle ImpCaptureStyle
bool HasImplicitReturnType
Capture & getCXXThisCapture()
Retrieve the capture of C++ 'this', if it has been captured.
bool isCXXThisCaptured() const
Determine whether the C++ 'this' is captured.
SmallVector< NamedDecl *, 4 > LocalPacks
Packs introduced by this, if any.
void addCapture(ValueDecl *Var, bool isBlock, bool isByref, bool isNested, SourceLocation Loc, SourceLocation EllipsisLoc, QualType CaptureType, bool Invalid)
SmallVector< ReturnStmt *, 4 > Returns
The list of return statements that occur within the function or block, if there is any chance of appl...
SourceLocation PotentialThisCaptureLocation
void finishedExplicitCaptures()
Note when all explicit captures have been added.
CleanupInfo Cleanup
Whether any of the capture expressions requires cleanups.
SourceRange IntroducerRange
Source range covering the lambda introducer [...].
bool ExplicitParams
Whether the (empty) parameter list is explicit.
TemplateParameterList * GLTemplateParameterList
If this is a generic lambda, and the template parameter list has been created (from the TemplateParam...
ExprResult RequiresClause
The requires-clause immediately following the explicit template parameter list, if any.
SourceRange ExplicitTemplateParamsRange
Source range covering the explicit template parameter list (if it exists).
CXXRecordDecl * Lambda
The class that describes the lambda.
unsigned NumExplicitCaptures
The number of captures in the Captures list that are explicit captures.
SourceLocation CaptureDefaultLoc
Source location of the '&' or '=' specifying the default capture type, if any.
llvm::DenseMap< unsigned, SourceRange > ExplicitCaptureRanges
A map of explicit capture indices to their introducer source ranges.
bool AfterParameterList
Indicate that we parsed the parameter list at which point the mutability of the lambda is known.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
bool Mutable
Whether this is a mutable lambda.
Defines the clang::TargetInfo interface.
The JSON file list parser is used to communicate input to InstallAPI.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(const_cast< Expr * >(T -> getSizeExpr())))
DeclContext * getLambdaAwareParentOfDeclContext(DeclContext *DC)
std::optional< unsigned > getStackIndexOfNearestEnclosingCaptureCapableLambda(ArrayRef< const sema::FunctionScopeInfo * > FunctionScopes, ValueDecl *VarToCapture, Sema &S)
Examines the FunctionScopeInfo stack to determine the nearest enclosing lambda (to the current lambda...
ConstexprSpecKind
Define the kind of constexpr specifier.
@ ICIS_NoInit
No in-class initializer.
@ RQ_None
No ref-qualifier was provided.
LambdaCaptureKind
The different capture forms in a lambda introducer.
@ LCK_ByCopy
Capturing by copy (a.k.a., by value)
@ LCK_ByRef
Capturing by reference.
@ LCK_VLAType
Capturing variable-length array type.
@ LCK_StarThis
Capturing the *this object by copy.
@ LCK_This
Capturing the *this object by reference.
bool isLambdaCallWithExplicitObjectParameter(const DeclContext *DC)
StorageClass
Storage classes.
bool FTIHasSingleVoidParameter(const DeclaratorChunk::FunctionTypeInfo &FTI)
@ CopyInit
[a = b], [a = {b}]
bool isLambdaCallOperator(const CXXMethodDecl *MD)
@ Result
The result type of a method or function.
bool hasWeakerNullability(NullabilityKind L, NullabilityKind R)
Return true if L has a weaker nullability annotation than R.
ActionResult< Expr * > ExprResult
LangAS
Defines the address space values used by the address space qualifier of QualType.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
StringRef getLambdaStaticInvokerName()
const FunctionProtoType * T
CallingConv
CallingConv - Specifies the calling convention that a function uses.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ EST_BasicNoexcept
noexcept
MutableArrayRef< Expr * > MultiExprArg
Information about how a lambda is numbered within its context.
unsigned DeviceManglingNumber
bool HasKnownInternalLinkage
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
SourceLocation getTrailingReturnTypeLoc() const
Get the trailing-return-type location for this function declarator.
bool hasTrailingReturnType() const
Determine whether this function declarator had a trailing-return-type.
ParsedType getTrailingReturnType() const
Get the trailing-return-type for this function declarator.
bool hasMutableQualifier() const
Determine whether this lambda-declarator contains a 'mutable' qualifier.
DeclSpec & getOrCreateMethodQualifiers()
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed.
ExceptionSpecificationType Type
The kind of exception specification this is.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
RefQualifierKind RefQualifier
unsigned HasTrailingReturn
FunctionType::ExtInfo ExtInfo
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.
Represents a complete lambda introducer.
SmallVector< LambdaCapture, 4 > Captures
SourceLocation DefaultLoc
LambdaCaptureDefault Default
An RAII helper that pops function a function scope on exit.