clang: lib/Sema/SemaExceptionSpec.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
23#include "llvm/ADT/SmallPtrSet.h"
24#include
25
27
29{
31 T = PtrTy->getPointeeType();
33 T = RefTy->getPointeeType();
35 T = MPTy->getPointeeType();
37}
38
39
40
41
42
43
44
46 auto *RD = dyn_cast(CurContext);
47
48 if (().NeedsStdLibCxxWorkaroundBefore(2016'04'27))
49 return false;
50
51
52
53 if (!RD || !RD->getIdentifier() || !RD->getDescribedClassTemplate() ||
55 return false;
56
57 auto *ND = dyn_cast(RD->getDeclContext());
58 if (!ND)
59 return false;
60
61 bool IsInStd = ND->isStdNamespace();
62 if (!IsInStd) {
63
64
66 if (!II || !(II->isStr("__debug") || II->isStr("__profile")) ||
67 !ND->isInStdNamespace())
68 return false;
69 }
70
71
73 return false;
74
75 return llvm::StringSwitch(RD->getIdentifier()->getName())
76 .Case("array", true)
77 .Case("pair", IsInStd)
78 .Case("priority_queue", IsInStd)
79 .Case("stack", IsInStd)
80 .Case("queue", IsInStd)
81 .Default(false);
82}
83
86
90 return NoexceptExpr;
91 }
92
96
99
100 auto *BoolExpr = new (Context)
102 llvm::APSInt Value{1};
105 }
106
109 return Converted;
110 }
111
114 return Converted;
115}
116
118
119
120
121
122
123
124 if (T->isArrayType())
125 T = Context.getArrayDecayedType(T);
126 else if (T->isFunctionType())
128
129 int Kind = 0;
133 Kind = 1;
134
135
136
138 return false;
141 Kind = 2;
142
143 if (RT->isRValueReferenceType()) {
144
145
146
147 Diag(Range.getBegin(), diag::err_rref_in_exception_spec)
148 << T << Range;
149 return true;
150 }
151 }
152
153
154
155
156
157
158
159
160 unsigned DiagID = diag::err_incomplete_in_exception_spec;
161 bool ReturnValueOnError = true;
163 DiagID = diag::ext_incomplete_in_exception_spec;
164 ReturnValueOnError = false;
165 }
167 !(RD && RD->isBeingDefined()) &&
169 return ReturnValueOnError;
170
171
173 Diag(Range.getBegin(), diag::err_wasm_reftype_exception_spec);
174 return true;
175 }
176
177
178
180 Diag(Range.getBegin(), diag::err_sizeless_in_exception_spec)
181 << (Kind == 2 ? 1 : 0) << PointeeT << Range;
182 return true;
183 }
184
185 return false;
186}
187
189
190
192 return false;
193
195 T = PT->getPointeeType();
197 T = PT->getPointeeType();
198 else
199 return false;
200
202 if (!FnT)
203 return false;
204
206}
207
211 Diag(Loc, diag::err_exception_spec_not_parsed);
212 return nullptr;
213 }
214
216 return FPT;
217
221
222
224 return SourceFPT;
225
226
229 else
231
235 Diag(Loc, diag::err_exception_spec_not_parsed);
236 Proto = nullptr;
237 }
238 return Proto;
239}
240
241void
244
247 Listener->ResolvedExceptionSpec(FD);
248
250 Context.adjustExceptionSpec(Redecl, ESI);
251}
252
257 return true;
259 return false;
262}
263
265 Sema &S, const PartialDiagnostic &DiagID, const PartialDiagnostic &NoteID,
266 const FunctionProtoType *Old, SourceLocation OldLoc,
267 const FunctionProtoType *New, SourceLocation NewLoc,
268 bool *MissingExceptionSpecification = nullptr,
269 bool *MissingEmptyExceptionSpecification = nullptr,
270 bool AllowNoexceptAllMatchWithNoSpec = false, bool IsOperatorNew = false);
271
272
273
276 Decl->getDeclName().getCXXOverloadedOperator() != OO_Delete &&
277 Decl->getDeclName().getCXXOverloadedOperator() != OO_Array_Delete)
278 return false;
279
280
281
282
283
284
285 if (->getTypeSourceInfo())
287
290}
291
293
294
295
297 return false;
298
300 bool IsOperatorNew = OO == OO_New || OO == OO_Array_New;
301 bool MissingExceptionSpecification = false;
302 bool MissingEmptyExceptionSpecification = false;
303
304 unsigned DiagID = diag::err_mismatched_exception_spec;
305 bool ReturnValueOnError = true;
307 DiagID = diag::ext_mismatched_exception_spec;
308 ReturnValueOnError = false;
309 }
310
311
312
313
316 return false;
317 }
318
319
320
322 *this, PDiag(DiagID), PDiag(diag::note_previous_declaration),
325 &MissingExceptionSpecification, &MissingEmptyExceptionSpecification,
326 true, IsOperatorNew)) {
327
328
329
330
333 Diag(New->getLocation(), diag::ext_implicit_exception_spec_mismatch)
336 Diag(Old->getLocation(), diag::note_previous_declaration);
337 }
338 return false;
339 }
340
341
342
343 if (!MissingExceptionSpecification)
344 return ReturnValueOnError;
345
347
348
349
350
351
352
353
354
355
356 if (MissingEmptyExceptionSpecification &&
361 New->setType(Context.getFunctionType(
362 NewProto->getReturnType(), NewProto->getParamTypes(),
363 NewProto->getExtProtoInfo().withExceptionSpec(EST_DynamicNone)));
364 return false;
365 }
366
368
371
372
373 ESI.Exceptions = OldProto->exceptions();
374 }
375
380
381
382
384 New->setInvalidDecl();
385 } else {
386
387
388 New->setType(Context.getFunctionType(
389 NewProto->getReturnType(), NewProto->getParamTypes(),
390 NewProto->getExtProtoInfo().withExceptionSpec(ESI)));
391 }
392
394 DiagID = diag::ext_missing_exception_specification;
395 ReturnValueOnError = false;
396 } else if (New->isReplaceableGlobalAllocationFunction() &&
398
399
400 DiagID = diag::ext_missing_exception_specification;
401 ReturnValueOnError = false;
403
405 return false;
406 }
407
408
409 DiagID = diag::ext_missing_exception_specification;
410 ReturnValueOnError = false;
411 } else {
412 DiagID = diag::err_missing_exception_specification;
413 ReturnValueOnError = true;
414 }
415
416
418 llvm::raw_svector_ostream OS(ExceptionSpecString);
419 switch (OldProto->getExceptionSpecType()) {
421 OS << "throw()";
422 break;
423
425 OS << "throw(";
426 bool OnFirstException = true;
427 for (const auto &E : OldProto->exceptions()) {
428 if (OnFirstException)
429 OnFirstException = false;
430 else
431 OS << ", ";
432
434 }
435 OS << ")";
436 break;
437 }
438
440 OS << "noexcept";
441 break;
442
446 OS << "noexcept(";
447 assert(OldProto->getNoexceptExpr() != nullptr && "Expected non-null Expr");
448 OldProto->getNoexceptExpr()->printPretty(OS, nullptr, getPrintingPolicy());
449 OS << ")";
450 break;
452 OS <<"__attribute__((nothrow))";
453 break;
459 llvm_unreachable("This spec type is compatible with none.");
460 }
461
465
466
468 if (!FTLoc.getTypePtr()->hasTrailingReturn())
470 }
471
473 Diag(New->getLocation(), DiagID)
475 else {
476 Diag(New->getLocation(), DiagID)
479 }
480
482 Diag(Old->getLocation(), diag::note_previous_declaration);
483
484 return ReturnValueOnError;
485}
486
491 return false;
492
493 unsigned DiagID = diag::err_mismatched_exception_spec;
495 DiagID = diag::ext_mismatched_exception_spec;
497 *this, PDiag(DiagID), PDiag(diag::note_previous_declaration),
498 Old, OldLoc, New, NewLoc);
499
500
502 return false;
504}
505
506
507
508
509
510
511
516 bool *MissingExceptionSpecification,
517 bool *MissingEmptyExceptionSpecification,
518 bool AllowNoexceptAllMatchWithNoSpec, bool IsOperatorNew) {
519 if (MissingExceptionSpecification)
520 *MissingExceptionSpecification = false;
521
522 if (MissingEmptyExceptionSpecification)
523 *MissingEmptyExceptionSpecification = false;
524
526 if (!Old)
527 return false;
529 if ()
530 return false;
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
553
556 "Shouldn't see unknown exception specifications here");
557
560
561
563 return false;
564
565
568
569
570 if (!AllowNoexceptAllMatchWithNoSpec &&
573
574 } else {
575 return false;
576 }
577 }
578
579
580
581
583 llvm::FoldingSetNodeID OldFSN, NewFSN;
585 New->getNoexceptExpr()->Profile(NewFSN, S.Context, true);
586 if (OldFSN == NewFSN)
587 return false;
588 }
589
590
591
594
595
597 for (const auto &I : Old->exceptions())
599
600 for (const auto &I : New->exceptions()) {
602 if (OldTypes.count(TypePtr))
603 NewTypes.insert(TypePtr);
604 else {
606 break;
607 }
608 }
609
610 if (Success && OldTypes.size() == NewTypes.size())
611 return false;
612 }
613
614
615
616
617 if (S.getLangOpts().CPlusPlus11 && IsOperatorNew) {
620 WithExceptions = New;
622 WithExceptions = Old;
623 if (WithExceptions && WithExceptions->getNumExceptions() == 1) {
624
625
629 if (Name && Name->getName() == "bad_alloc") {
630
631 if (ExRecord->isInStdNamespace()) {
632 return false;
633 }
634 }
635 }
636 }
637 }
638
639
640
641 if (MissingExceptionSpecification && OldEST != EST_None &&
643
644
645 *MissingExceptionSpecification = true;
646
647 if (MissingEmptyExceptionSpecification && OldCanThrow == CT_Cannot) {
648
649
650
651 *MissingEmptyExceptionSpecification = true;
652 }
653
654 return true;
655 }
656
657 S.Diag(NewLoc, DiagID);
659 S.Diag(OldLoc, NoteID);
660 return true;
661}
662
670 return false;
672 New, NewLoc);
673}
674
676
677
678
679
680
682 if (RefTy)
684
685
686 if (Context.hasSameUnqualifiedType(ExceptionType, HandlerType))
687 return true;
688
689
693 return false;
694
695
696
698 return true;
699
700
701
702
703
704
705 bool LifetimeConv;
706
707
709 LifetimeConv) ||
711 return true;
712
713
715 return false;
716
717
719 ExceptionType = Context.getUnqualifiedArrayType(
721 HandlerType =
724 return false;
725
727 return true;
728
729
730 }
731
732
733
735 return false;
736 CXXBasePaths Paths(true, true,
737 false);
740 return false;
741
742
745 0,
746 true,
747 true)) {
751 llvm_unreachable("access check dependent for unprivileged context");
753 llvm_unreachable("access check delayed in non-declaration");
754 }
755 llvm_unreachable("unexpected access check result");
756}
757
761 const FunctionProtoType *Superset, bool SkipSupersetFirstParameter,
763 bool SkipSubsetFirstParameter, SourceLocation SubLoc) {
764
765
767 return false;
768
769
770
771
773 SubLoc = SuperLoc;
774
775
777 if (!Superset)
778 return false;
780 if (!Subset)
781 return false;
782
787 "Shouldn't see unknown exception specifications here");
788
789
790
791
792
794 return false;
795
798
799
800
804 SkipSupersetFirstParameter, SuperLoc, Subset,
805 SkipSubsetFirstParameter, SubLoc);
806
807
808
809 if (NoThrowDiagID.getDiagID() != 0 && SubCanThrow == CT_Can &&
811 Diag(SubLoc, NoThrowDiagID);
813 Diag(SuperLoc, NoteID);
814 return true;
815 }
816
817
818
821 Diag(SubLoc, DiagID);
823 Diag(SuperLoc, NoteID);
824 return true;
825 }
826
828 "Exception spec subset: non-dynamic case slipped through.");
829
830
833 SubI = RefTy->getPointeeType();
834
835
836 bool Contained = false;
838
839
840
841
842
843
845 Contained = true;
846 break;
847 }
848 }
849 if (!Contained) {
850 Diag(SubLoc, DiagID);
852 Diag(SuperLoc, NoteID);
853 return true;
854 }
855 }
856
858 SkipSupersetFirstParameter, SuperLoc, Subset,
859 SkipSupersetFirstParameter, SubLoc);
860}
861
862static bool
868 if (!TFunc)
869 return false;
871 if (!SFunc)
872 return false;
873
875 SFunc, SourceLoc);
876}
877
882 bool SkipSourceFirstParameter, SourceLocation SourceLoc) {
883 auto RetDiag = DiagID;
884 RetDiag << 0;
886 *this, RetDiag, PDiag(),
887 Target->getReturnType(), TargetLoc, Source->getReturnType(),
888 SourceLoc))
889 return true;
890
891
892
893 assert((Target->getNumParams() - (unsigned)SkipTargetFirstParameter) ==
894 (Source->getNumParams() - (unsigned)SkipSourceFirstParameter) &&
895 "Functions have different argument counts.");
896 for (unsigned i = 0, E = Target->getNumParams(); i != E; ++i) {
897 auto ParamDiag = DiagID;
898 ParamDiag << 1;
900 *this, ParamDiag, PDiag(),
901 Target->getParamType(i + (SkipTargetFirstParameter ? 1 : 0)),
902 TargetLoc, Source->getParamType(SkipSourceFirstParameter ? 1 : 0),
903 SourceLoc))
904 return true;
905 }
906 return false;
907}
908
910
911
914 return false;
915
916
919 return false;
920
921 unsigned DiagID = diag::err_incompatible_exception_specs;
922 unsigned NestedDiagID = diag::err_deep_exception_specs_differ;
923
924
925
927 DiagID = diag::warn_incompatible_exception_specs;
928 NestedDiagID = diag::warn_deep_exception_specs_differ;
929 }
930
931
932
933
934
935
936
937
938
939
940
941
942
944 PDiag(), ToFunc, 0,
948}
949
952
953
956 return false;
957
958
959
961 return false;
962
963
964
965
966
969 return false;
970 }
971
972 unsigned DiagID = diag::err_override_exception_spec;
974 DiagID = diag::ext_override_exception_spec;
976 PDiag(DiagID), PDiag(diag::err_deep_exception_specs_differ),
977 PDiag(diag::note_overridden_virtual_function),
978 PDiag(diag::ext_override_exception_spec),
982 New->hasCXXExplicitFunctionObjectParameter(), New->getLocation());
983}
984
988 if (!SubStmt)
989 continue;
992 break;
993 }
994 return R;
995}
996
999
1000
1001 if (isa_and_nonnull(D) && D->hasAttr())
1003
1005
1006
1007 if (S.getLangOpts().CPlusPlus17 && isa_and_nonnull(E)) {
1010 if (T->isSpecificPlaceholderType(BuiltinType::BoundMember)) {
1011
1012
1014
1015
1016 if (auto *Op = dyn_cast(E)) {
1017 assert(Op->getOpcode() == BO_PtrMemD || Op->getOpcode() == BO_PtrMemI);
1018 T = Op->getRHS()->getType()
1020 } else {
1022 }
1023 }
1024 } else if (const ValueDecl *VD = dyn_cast_or_null(D))
1025 T = VD->getType();
1026 else
1027
1029
1040
1041 if (!FT)
1043
1046 if (!FT)
1048
1050}
1051
1054
1055
1059
1060
1062 if (auto *RD =
1064 if (auto *Dtor = RD->getDestructor()) {
1067 }
1068 }
1069 }
1070
1071
1072 if (auto *DD = dyn_cast(VD))
1073 for (auto *B : DD->flat_bindings())
1074 if (auto *HD = B->getHoldingVar())
1076
1077 return CT;
1078}
1079
1092
1094
1097
1100
1101
1104
1105
1108
1110}
1111
1113
1114
1115
1117 case Expr::ConstantExprClass:
1119
1120 case Expr::CXXThrowExprClass:
1121
1123
1124 case Expr::CXXDynamicCastExprClass: {
1125
1126
1128
1129 if (CE->getType()->isVariablyModifiedType())
1133 return CT;
1135 }
1136
1137 case Expr::CXXTypeidExprClass:
1138
1139
1140
1142
1143
1144
1145
1146 case Expr::CallExprClass:
1147 case Expr::CXXMemberCallExprClass:
1148 case Expr::CXXOperatorCallExprClass:
1149 case Expr::UserDefinedLiteralClass: {
1156 else
1159 return CT;
1161 }
1162
1163 case Expr::CXXConstructExprClass:
1164 case Expr::CXXTemporaryObjectExprClass: {
1166
1167 if (CE->getType()->isVariablyModifiedType())
1171 return CT;
1173 }
1174
1175 case Expr::CXXInheritedCtorInitExprClass: {
1177 return canCalleeThrow(*this, ICIE, ICIE->getConstructor());
1178 }
1179
1180 case Expr::LambdaExprClass: {
1186 Cap != CapEnd; ++Cap)
1188 return CT;
1189 }
1190
1191 case Expr::CXXNewExprClass: {
1194 if (NE->isTypeDependent())
1196 else
1197 CT = canCalleeThrow(*this, NE, NE->getOperatorNew());
1199 return CT;
1201 }
1202
1203 case Expr::CXXDeleteExprClass: {
1206 QualType DTy = DE->getDestroyedType();
1209 } else {
1210
1211
1212
1213
1214
1215 const FunctionDecl *OperatorDelete = DE->getOperatorDelete();
1220 }
1221
1222
1224
1225
1227 return CT;
1228 }
1230 }
1231
1232 case Expr::CXXBindTemporaryExprClass: {
1234
1236 canCalleeThrow(*this, BTE, BTE->getTemporary()->getDestructor());
1238 return CT;
1240 }
1241
1242 case Expr::PseudoObjectExprClass: {
1245 for (const Expr *E : POE->semantics()) {
1248 break;
1249 }
1250 return CT;
1251 }
1252
1253
1254
1255 case Expr::ObjCMessageExprClass:
1256 case Expr::ObjCPropertyRefExprClass:
1257 case Expr::ObjCSubscriptRefExprClass:
1259
1260
1261
1262
1263 case Expr::ObjCArrayLiteralClass:
1264 case Expr::ObjCDictionaryLiteralClass:
1265 case Expr::ObjCBoxedExprClass:
1267
1268
1269
1270 case Expr::CoawaitExprClass:
1271 case Expr::ConditionalOperatorClass:
1272 case Expr::CoyieldExprClass:
1273 case Expr::CXXRewrittenBinaryOperatorClass:
1274 case Expr::CXXStdInitializerListExprClass:
1275 case Expr::DesignatedInitExprClass:
1276 case Expr::DesignatedInitUpdateExprClass:
1277 case Expr::ExprWithCleanupsClass:
1278 case Expr::ExtVectorElementExprClass:
1279 case Expr::InitListExprClass:
1280 case Expr::ArrayInitLoopExprClass:
1281 case Expr::MemberExprClass:
1282 case Expr::ObjCIsaExprClass:
1283 case Expr::ObjCIvarRefExprClass:
1284 case Expr::ParenExprClass:
1285 case Expr::ParenListExprClass:
1286 case Expr::ShuffleVectorExprClass:
1287 case Expr::StmtExprClass:
1288 case Expr::ConvertVectorExprClass:
1289 case Expr::VAArgExprClass:
1290 case Expr::CXXParenListInitExprClass:
1292
1293 case Expr::CompoundLiteralExprClass:
1294 case Expr::CXXConstCastExprClass:
1295 case Expr::CXXAddrspaceCastExprClass:
1296 case Expr::CXXReinterpretCastExprClass:
1297 case Expr::BuiltinBitCastExprClass:
1298
1302
1303
1304 case Expr::ArraySubscriptExprClass:
1305 case Expr::MatrixSubscriptExprClass:
1306 case Expr::ArraySectionExprClass:
1307 case Expr::OMPArrayShapingExprClass:
1308 case Expr::OMPIteratorExprClass:
1309 case Expr::BinaryOperatorClass:
1310 case Expr::DependentCoawaitExprClass:
1311 case Expr::CompoundAssignOperatorClass:
1312 case Expr::CStyleCastExprClass:
1313 case Expr::CXXStaticCastExprClass:
1314 case Expr::CXXFunctionalCastExprClass:
1315 case Expr::ImplicitCastExprClass:
1316 case Expr::MaterializeTemporaryExprClass:
1317 case Expr::UnaryOperatorClass: {
1318
1319 if (auto *CE = dyn_cast(S))
1320 if (CE->getType()->isVariablyModifiedType())
1325 }
1326
1327 case Expr::CXXDefaultArgExprClass:
1329
1330 case Expr::CXXDefaultInitExprClass:
1332
1333 case Expr::ChooseExprClass: {
1335 if (CE->isTypeDependent() || CE->isValueDependent())
1337 return canThrow(CE->getChosenSubExpr());
1338 }
1339
1340 case Expr::GenericSelectionExprClass:
1344
1345
1346 case Expr::CXXDependentScopeMemberExprClass:
1347 case Expr::CXXUnresolvedConstructExprClass:
1348 case Expr::DependentScopeDeclRefExprClass:
1349 case Expr::CXXFoldExprClass:
1350 case Expr::RecoveryExprClass:
1352
1353 case Expr::AsTypeExprClass:
1354 case Expr::BinaryConditionalOperatorClass:
1355 case Expr::BlockExprClass:
1356 case Expr::CUDAKernelCallExprClass:
1357 case Expr::DeclRefExprClass:
1358 case Expr::ObjCBridgedCastExprClass:
1359 case Expr::ObjCIndirectCopyRestoreExprClass:
1360 case Expr::ObjCProtocolExprClass:
1361 case Expr::ObjCSelectorExprClass:
1362 case Expr::ObjCAvailabilityCheckExprClass:
1363 case Expr::OffsetOfExprClass:
1364 case Expr::PackExpansionExprClass:
1365 case Expr::SubstNonTypeTemplateParmExprClass:
1366 case Expr::SubstNonTypeTemplateParmPackExprClass:
1367 case Expr::FunctionParmPackExprClass:
1368 case Expr::UnaryExprOrTypeTraitExprClass:
1369 case Expr::UnresolvedLookupExprClass:
1370 case Expr::UnresolvedMemberExprClass:
1371
1373
1374 case Expr::AddrLabelExprClass:
1375 case Expr::ArrayTypeTraitExprClass:
1376 case Expr::AtomicExprClass:
1377 case Expr::TypeTraitExprClass:
1378 case Expr::CXXBoolLiteralExprClass:
1379 case Expr::CXXNoexceptExprClass:
1380 case Expr::CXXNullPtrLiteralExprClass:
1381 case Expr::CXXPseudoDestructorExprClass:
1382 case Expr::CXXScalarValueInitExprClass:
1383 case Expr::CXXThisExprClass:
1384 case Expr::CXXUuidofExprClass:
1385 case Expr::CharacterLiteralClass:
1386 case Expr::ExpressionTraitExprClass:
1387 case Expr::FloatingLiteralClass:
1388 case Expr::GNUNullExprClass:
1389 case Expr::ImaginaryLiteralClass:
1390 case Expr::ImplicitValueInitExprClass:
1391 case Expr::IntegerLiteralClass:
1392 case Expr::FixedPointLiteralClass:
1393 case Expr::ArrayInitIndexExprClass:
1394 case Expr::NoInitExprClass:
1395 case Expr::ObjCEncodeExprClass:
1396 case Expr::ObjCStringLiteralClass:
1397 case Expr::ObjCBoolLiteralExprClass:
1398 case Expr::OpaqueValueExprClass:
1399 case Expr::PredefinedExprClass:
1400 case Expr::SizeOfPackExprClass:
1401 case Expr::PackIndexingExprClass:
1402 case Expr::StringLiteralClass:
1403 case Expr::SourceLocExprClass:
1404 case Expr::EmbedExprClass:
1405 case Expr::ConceptSpecializationExprClass:
1406 case Expr::RequiresExprClass:
1407 case Expr::HLSLOutArgExprClass:
1408 case Stmt::OpenACCEnterDataConstructClass:
1409 case Stmt::OpenACCExitDataConstructClass:
1410 case Stmt::OpenACCWaitConstructClass:
1411 case Stmt::OpenACCCacheConstructClass:
1412 case Stmt::OpenACCInitConstructClass:
1413 case Stmt::OpenACCShutdownConstructClass:
1414 case Stmt::OpenACCSetConstructClass:
1415 case Stmt::OpenACCUpdateConstructClass:
1416
1418
1419 case Expr::MSPropertyRefExprClass:
1420 case Expr::MSPropertySubscriptExprClass:
1421 llvm_unreachable("Invalid class for expression");
1422
1423
1424 case Stmt::OpenACCComputeConstructClass:
1425 case Stmt::OpenACCLoopConstructClass:
1426 case Stmt::OpenACCCombinedConstructClass:
1427 case Stmt::OpenACCDataConstructClass:
1428 case Stmt::OpenACCHostDataConstructClass:
1429 case Stmt::OpenACCAtomicConstructClass:
1430 case Stmt::AttributedStmtClass:
1431 case Stmt::BreakStmtClass:
1432 case Stmt::CapturedStmtClass:
1433 case Stmt::SYCLKernelCallStmtClass:
1434 case Stmt::CaseStmtClass:
1435 case Stmt::CompoundStmtClass:
1436 case Stmt::ContinueStmtClass:
1437 case Stmt::CoreturnStmtClass:
1438 case Stmt::CoroutineBodyStmtClass:
1439 case Stmt::CXXCatchStmtClass:
1440 case Stmt::CXXForRangeStmtClass:
1441 case Stmt::DefaultStmtClass:
1442 case Stmt::DoStmtClass:
1443 case Stmt::ForStmtClass:
1444 case Stmt::GCCAsmStmtClass:
1445 case Stmt::GotoStmtClass:
1446 case Stmt::IndirectGotoStmtClass:
1447 case Stmt::LabelStmtClass:
1448 case Stmt::MSAsmStmtClass:
1449 case Stmt::MSDependentExistsStmtClass:
1450 case Stmt::NullStmtClass:
1451 case Stmt::ObjCAtCatchStmtClass:
1452 case Stmt::ObjCAtFinallyStmtClass:
1453 case Stmt::ObjCAtSynchronizedStmtClass:
1454 case Stmt::ObjCAutoreleasePoolStmtClass:
1455 case Stmt::ObjCForCollectionStmtClass:
1456 case Stmt::OMPAtomicDirectiveClass:
1457 case Stmt::OMPAssumeDirectiveClass:
1458 case Stmt::OMPBarrierDirectiveClass:
1459 case Stmt::OMPCancelDirectiveClass:
1460 case Stmt::OMPCancellationPointDirectiveClass:
1461 case Stmt::OMPCriticalDirectiveClass:
1462 case Stmt::OMPDistributeDirectiveClass:
1463 case Stmt::OMPDistributeParallelForDirectiveClass:
1464 case Stmt::OMPDistributeParallelForSimdDirectiveClass:
1465 case Stmt::OMPDistributeSimdDirectiveClass:
1466 case Stmt::OMPFlushDirectiveClass:
1467 case Stmt::OMPDepobjDirectiveClass:
1468 case Stmt::OMPScanDirectiveClass:
1469 case Stmt::OMPForDirectiveClass:
1470 case Stmt::OMPForSimdDirectiveClass:
1471 case Stmt::OMPMasterDirectiveClass:
1472 case Stmt::OMPMasterTaskLoopDirectiveClass:
1473 case Stmt::OMPMaskedTaskLoopDirectiveClass:
1474 case Stmt::OMPMasterTaskLoopSimdDirectiveClass:
1475 case Stmt::OMPMaskedTaskLoopSimdDirectiveClass:
1476 case Stmt::OMPOrderedDirectiveClass:
1477 case Stmt::OMPCanonicalLoopClass:
1478 case Stmt::OMPParallelDirectiveClass:
1479 case Stmt::OMPParallelForDirectiveClass:
1480 case Stmt::OMPParallelForSimdDirectiveClass:
1481 case Stmt::OMPParallelMasterDirectiveClass:
1482 case Stmt::OMPParallelMaskedDirectiveClass:
1483 case Stmt::OMPParallelMasterTaskLoopDirectiveClass:
1484 case Stmt::OMPParallelMaskedTaskLoopDirectiveClass:
1485 case Stmt::OMPParallelMasterTaskLoopSimdDirectiveClass:
1486 case Stmt::OMPParallelMaskedTaskLoopSimdDirectiveClass:
1487 case Stmt::OMPParallelSectionsDirectiveClass:
1488 case Stmt::OMPSectionDirectiveClass:
1489 case Stmt::OMPSectionsDirectiveClass:
1490 case Stmt::OMPSimdDirectiveClass:
1491 case Stmt::OMPTileDirectiveClass:
1492 case Stmt::OMPStripeDirectiveClass:
1493 case Stmt::OMPUnrollDirectiveClass:
1494 case Stmt::OMPReverseDirectiveClass:
1495 case Stmt::OMPInterchangeDirectiveClass:
1496 case Stmt::OMPFuseDirectiveClass:
1497 case Stmt::OMPSingleDirectiveClass:
1498 case Stmt::OMPTargetDataDirectiveClass:
1499 case Stmt::OMPTargetDirectiveClass:
1500 case Stmt::OMPTargetEnterDataDirectiveClass:
1501 case Stmt::OMPTargetExitDataDirectiveClass:
1502 case Stmt::OMPTargetParallelDirectiveClass:
1503 case Stmt::OMPTargetParallelForDirectiveClass:
1504 case Stmt::OMPTargetParallelForSimdDirectiveClass:
1505 case Stmt::OMPTargetSimdDirectiveClass:
1506 case Stmt::OMPTargetTeamsDirectiveClass:
1507 case Stmt::OMPTargetTeamsDistributeDirectiveClass:
1508 case Stmt::OMPTargetTeamsDistributeParallelForDirectiveClass:
1509 case Stmt::OMPTargetTeamsDistributeParallelForSimdDirectiveClass:
1510 case Stmt::OMPTargetTeamsDistributeSimdDirectiveClass:
1511 case Stmt::OMPTargetUpdateDirectiveClass:
1512 case Stmt::OMPScopeDirectiveClass:
1513 case Stmt::OMPTaskDirectiveClass:
1514 case Stmt::OMPTaskgroupDirectiveClass:
1515 case Stmt::OMPTaskLoopDirectiveClass:
1516 case Stmt::OMPTaskLoopSimdDirectiveClass:
1517 case Stmt::OMPTaskwaitDirectiveClass:
1518 case Stmt::OMPTaskyieldDirectiveClass:
1519 case Stmt::OMPErrorDirectiveClass:
1520 case Stmt::OMPTeamsDirectiveClass:
1521 case Stmt::OMPTeamsDistributeDirectiveClass:
1522 case Stmt::OMPTeamsDistributeParallelForDirectiveClass:
1523 case Stmt::OMPTeamsDistributeParallelForSimdDirectiveClass:
1524 case Stmt::OMPTeamsDistributeSimdDirectiveClass:
1525 case Stmt::OMPInteropDirectiveClass:
1526 case Stmt::OMPDispatchDirectiveClass:
1527 case Stmt::OMPMaskedDirectiveClass:
1528 case Stmt::OMPMetaDirectiveClass:
1529 case Stmt::OMPGenericLoopDirectiveClass:
1530 case Stmt::OMPTeamsGenericLoopDirectiveClass:
1531 case Stmt::OMPTargetTeamsGenericLoopDirectiveClass:
1532 case Stmt::OMPParallelGenericLoopDirectiveClass:
1533 case Stmt::OMPTargetParallelGenericLoopDirectiveClass:
1534 case Stmt::ReturnStmtClass:
1535 case Stmt::SEHExceptStmtClass:
1536 case Stmt::SEHFinallyStmtClass:
1537 case Stmt::SEHLeaveStmtClass:
1538 case Stmt::SEHTryStmtClass:
1539 case Stmt::SwitchStmtClass:
1540 case Stmt::WhileStmtClass:
1541 case Stmt::DeferStmtClass:
1543
1544 case Stmt::DeclStmtClass: {
1547 if (auto *VD = dyn_cast(D))
1549
1550
1551 if (auto *TND = dyn_cast(D))
1552 if (TND->getUnderlyingType()->isVariablyModifiedType())
1554 if (auto *VD = dyn_cast(D))
1555 if (VD->getType()->isVariablyModifiedType())
1557 }
1558 return CT;
1559 }
1560
1561 case Stmt::IfStmtClass: {
1564 if (const Stmt *Init = IS->getInit())
1566 if (const Stmt *CondDS = IS->getConditionVariableDeclStmt())
1569
1570
1571
1572 if (std::optional<const Stmt *> Case = IS->getNondiscardedCase(Context))
1574
1577 if (Then == Else)
1579
1580
1581
1584 }
1585
1586 case Stmt::CXXTryStmtClass: {
1588
1589
1590 const CXXCatchStmt *FinalHandler = TS->getHandler(TS->getNumHandlers() - 1);
1594 }
1595
1596 case Stmt::ObjCAtThrowStmtClass:
1598
1599 case Stmt::ObjCAtTryStmtClass: {
1601
1602
1603
1605 if (const Stmt *Finally = TS->getFinallyStmt())
1607 for (unsigned I = TS->getNumCatchStmts(); I != 0; --I) {
1610
1612 return CT;
1613 }
1614
1615
1617 }
1618
1619 case Stmt::SYCLUniqueStableNameExprClass:
1621 case Stmt::OpenACCAsteriskSizeExprClass:
1624 llvm_unreachable("Invalid class for statement");
1625 }
1626 llvm_unreachable("Bogus StmtClass");
1627}
1628
1629}
Defines the Diagnostic-related interfaces.
Defines the clang::Expr interface and subclasses for C++ expressions.
TokenType getType() const
Returns the token's type, e.g.
Defines the clang::Preprocessor interface.
Defines the SourceManager interface.
Defines the Objective-C statement AST node classes.
Expr * getExpr()
Get 'expr' part of the associated expression/statement.
static QualType getPointeeType(const MemRegion *R)
Defines the clang::TypeLoc interface and its subclasses.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
static CanQualType getCanonicalType(QualType T)
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
bool isAmbiguous(CanQualType BaseType) const
Determine whether the path from the most-derived type to the given base type is ambiguous (i....
A boolean literal, per ([C++ lex.bool] Boolean literals).
CXXCatchStmt - This represents a C++ catch block.
Stmt * getHandlerBlock() const
VarDecl * getExceptionDecl() const
Represents a C++ destructor within a class.
bool isCalledByDelete(const FunctionDecl *OpDel=nullptr) const
Will this destructor ever be called when considering which deallocation function is associated with t...
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Represents a static or instance method of a struct/union/class.
Represents a C++ struct/union/class.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
bool isTypeOperand() const
Expr * getExprOperand() const
bool isPotentiallyEvaluated() const
Determine whether this typeid has a type operand which is potentially evaluated, per C++11 [expr....
bool hasNullCheck() const
Whether this is of a form like "typeid(*ptr)" that can throw a std::bad_typeid if a pointer is a null...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
CastKind getCastKind() const
static ConstantExpr * Create(const ASTContext &Context, Expr *E, const APValue &Result)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Decl - This represents one declaration (or definition), e.g.
SourceLocation getLocation() const
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
Information about one declarator, including the parsed type information and the identifier.
SourceLocation getBeginLoc() const LLVM_READONLY
const IdentifierInfo * getIdentifier() const
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
This represents one expression.
bool isValueDependent() const
Determines whether the value of this expression depends on.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates).
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
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.
Represents a function declaration or definition.
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
bool hasCXXExplicitFunctionObjectParameter() const
bool isExternC() const
Determines whether this function is a function with external, C linkage.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
Represents a prototype with parameter type info, e.g.
bool hasDependentExceptionSpec() const
Return whether this function has a dependent exception spec.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
unsigned getNumExceptions() const
Return the number of types in the exception specification.
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
CanThrowResult canThrow() const
Determine whether this function type has a non-throwing exception specification.
Expr * getNoexceptExpr() const
Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...
ArrayRef< QualType > exceptions() const
exception_iterator exception_begin() const
FunctionDecl * getExceptionSpecDecl() const
If this function type has an exception specification which hasn't been determined yet (either because...
One of these records is kept for each identifier that is lexed.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
StringRef getName() const
Return the actual identifier string.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
capture_init_iterator capture_init_end()
Retrieve the iterator pointing one past the last initialization argument for this lambda expression.
Expr *const * const_capture_init_iterator
Const iterator that walks over the capture initialization arguments.
capture_init_iterator capture_init_begin()
Retrieve the first initialization argument for this lambda expression (which initializes the first ca...
A pointer to member type per C++ 8.3.3 - Pointers to members.
Represents Objective-C's @catch statement.
unsigned getDiagID() const
PointerType - C99 6.7.5.1 - Pointer Declarators.
A (possibly-)qualified type.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool isWebAssemblyReferenceType() const
Returns true if it is a WebAssembly Reference Type.
bool isConstQualified() const
Determine whether this type is const-qualified.
The collection of all-type qualifiers we support.
bool compatiblyIncludes(Qualifiers other, const ASTContext &Ctx) const
Determines if these qualifiers compatibly include another set.
Base for LValueReferenceType and RValueReferenceType.
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID)
Emit a diagnostic.
Sema - This implements semantic analysis and AST building for C.
bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range)
CheckSpecifiedExceptionType - Check if the given type is valid in an exception specification.
Definition SemaExceptionSpec.cpp:117
void EvaluateImplicitExceptionSpec(SourceLocation Loc, FunctionDecl *FD)
Evaluate the implicit exception specification for a defaulted special member function.
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
Preprocessor & getPreprocessor() const
bool IsQualificationConversion(QualType FromType, QualType ToType, bool CStyle, bool &ObjCLifetimeConversion)
IsQualificationConversion - Determines whether the conversion from an rvalue of type FromType to ToTy...
ASTContext & getASTContext() const
SmallVector< std::pair< FunctionDecl *, FunctionDecl * >, 2 > DelayedEquivalentExceptionSpecChecks
All the function redeclarations seen during a class definition that had their exception spec checks d...
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const FunctionProtoType *Target, bool SkipTargetFirstParameter, SourceLocation TargetLoc, const FunctionProtoType *Source, bool SkipSourceFirstParameter, SourceLocation SourceLoc)
CheckParamExceptionSpec - Check if the parameter and return types of the two functions have equivalen...
Definition SemaExceptionSpec.cpp:878
Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, TranslationUnitKind TUKind=TU_Complete, CodeCompleteConsumer *CompletionConsumer=nullptr)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
Definition SemaExceptionSpec.cpp:209
ExprResult ActOnNoexceptSpec(Expr *NoexceptExpr, ExceptionSpecificationType &EST)
Check the given noexcept-specifier, convert its expression, and compute the appropriate ExceptionSpec...
Definition SemaExceptionSpec.cpp:84
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.
SmallVector< std::pair< const CXXMethodDecl *, const CXXMethodDecl * >, 2 > DelayedOverridingExceptionSpecChecks
All the overriding functions seen during a class definition that had their exception spec checks dela...
bool isLibstdcxxEagerExceptionSpecHack(const Declarator &D)
Determine if we're in a case where we need to (incorrectly) eagerly parse an exception specification ...
Definition SemaExceptionSpec.cpp:45
bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID, const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const PartialDiagnostic &NoThrowDiagID, const FunctionProtoType *Superset, bool SkipSupersetFirstParameter, SourceLocation SuperLoc, const FunctionProtoType *Subset, bool SkipSubsetFirstParameter, SourceLocation SubLoc)
CheckExceptionSpecSubset - Check whether the second function type's exception specification is a subs...
Definition SemaExceptionSpec.cpp:758
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
bool IsDerivedFrom(SourceLocation Loc, CXXRecordDecl *Derived, CXXRecordDecl *Base, CXXBasePaths &Paths)
Determine whether the type Derived is a C++ class that is derived from the type Base.
CanThrowResult canThrow(const Stmt *E)
Definition SemaExceptionSpec.cpp:1112
bool handlerCanCatch(QualType HandlerType, QualType ExceptionType)
Definition SemaExceptionSpec.cpp:675
bool CheckDistantExceptionSpec(QualType T)
CheckDistantExceptionSpec - Check if the given type is a pointer or pointer to member to a function w...
Definition SemaExceptionSpec.cpp:188
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
bool CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New)
Definition SemaExceptionSpec.cpp:292
bool CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionExceptionSpec - Checks whether the exception spec is a subset of base spec.
Definition SemaExceptionSpec.cpp:950
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
Definition SemaExceptionSpec.cpp:242
bool IsFunctionConversion(QualType FromType, QualType ToType) const
Determine whether the conversion from FromType to ToType is a valid conversion of ExtInfo/ExtProtoInf...
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
Definition SemaExceptionSpec.cpp:909
ASTMutationListener * getASTMutationListener() const
static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D, SourceLocation Loc=SourceLocation())
Determine whether the callee of a particular function call can throw.
Definition SemaExceptionSpec.cpp:997
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 getBegin() const
Stmt - This represents one statement.
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const
Produce a unique representation of the given statement.
SourceLocation getBeginLoc() const LLVM_READONLY
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...
TypeLoc IgnoreParens() const
A container of type source information.
bool isSizelessType() const
As an extension, we classify types as one of "sized" or "sizeless"; every type is one or the other.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
bool isPointerType() const
const T * castAs() const
Member-template castAs.
bool isReferenceType() const
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...
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
bool isMemberPointerType() const
bool isObjectType() const
Determine whether this type is an object type.
const T * getAs() const
Member-template getAs'.
bool isNullPtrType() const
bool isRecordType() const
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
QualType::DestructionKind needsDestruction(const ASTContext &Ctx) const
Would the destruction of this variable have any effect, and if so, what kind?
const Expr * getInit() const
bool isUsableInConstantExpressions(const ASTContext &C) const
Determine whether this variable's value can be used in a constant expression, according to the releva...
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isa(CodeGen::Address addr)
CanThrowResult
Possible results from evaluation of a noexcept expression.
static const FunctionProtoType * GetUnderlyingFunction(QualType T)
Definition SemaExceptionSpec.cpp:28
bool isDynamicExceptionSpec(ExceptionSpecificationType ESpecType)
static bool CheckEquivalentExceptionSpecImpl(Sema &S, const PartialDiagnostic &DiagID, const PartialDiagnostic &NoteID, const FunctionProtoType *Old, SourceLocation OldLoc, const FunctionProtoType *New, SourceLocation NewLoc, bool *MissingExceptionSpecification=nullptr, bool *MissingEmptyExceptionSpecification=nullptr, bool AllowNoexceptAllMatchWithNoSpec=false, bool IsOperatorNew=false)
CheckEquivalentExceptionSpec - Check if the two types have compatible exception specifications.
Definition SemaExceptionSpec.cpp:512
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
@ Success
Annotation was successful.
static bool hasImplicitExceptionSpec(FunctionDecl *Decl)
Determine whether a function has an implicitly-generated exception specification.
Definition SemaExceptionSpec.cpp:274
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
CanThrowResult mergeCanThrow(CanThrowResult CT1, CanThrowResult CT2)
@ Result
The result type of a method or function.
static CanThrowResult canVarDeclThrow(Sema &Self, const VarDecl *VD)
Definition SemaExceptionSpec.cpp:1052
static CanThrowResult canDynamicCastThrow(const CXXDynamicCastExpr *DC)
Definition SemaExceptionSpec.cpp:1080
const FunctionProtoType * T
static CanThrowResult canSubStmtsThrow(Sema &Self, const Stmt *S)
Definition SemaExceptionSpec.cpp:985
static CanThrowResult canTypeidThrow(Sema &S, const CXXTypeidExpr *DC)
Definition SemaExceptionSpec.cpp:1093
static bool CheckSpecForTypesEquivalent(Sema &S, const PartialDiagnostic &DiagID, const PartialDiagnostic &NoteID, QualType Target, SourceLocation TargetLoc, QualType Source, SourceLocation SourceLoc)
Definition SemaExceptionSpec.cpp:863
U cast(CodeGen::Address addr)
@ Noexcept
Condition in a noexcept(bool) specifier.
ActionResult< Expr * > ExprResult
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_DependentNoexcept
noexcept(expression), value-dependent
@ EST_Uninstantiated
not instantiated yet
@ EST_Unparsed
not parsed yet
@ EST_NoThrow
Microsoft __declspec(nothrow) extension.
@ EST_None
no exception specification
@ EST_MSAny
Microsoft throw(...) extension.
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_NoexceptTrue
noexcept(expression), evals to 'true'
@ EST_Dynamic
throw(T1, T2)
static bool exceptionSpecNotKnownYet(const FunctionDecl *FD)
Definition SemaExceptionSpec.cpp:253
Holds information about the various types of exception specification.
ExceptionSpecificationType Type
The kind of exception specification this is.