*RD = dyn_cast<CXXRecordDecl>(
CurContext);
50 if(!RD || !RD->getIdentifier() || !RD->getDescribedClassTemplate() ||
51!
D.getIdentifier() || !
D.getIdentifier()->isStr(
"swap"))
54 auto*ND = dyn_cast<NamespaceDecl>(RD->getDeclContext());
58 boolIsInStd = ND->isStdNamespace();
63 if(!II || !(II->
isStr(
"__debug") || II->
isStr(
"__profile")) ||
64!ND->isInStdNamespace())
72 returnllvm::StringSwitch<bool>(RD->getIdentifier()->getName())
73.Case(
"array",
true)
74.Case(
"pair", IsInStd)
75.Case(
"priority_queue", IsInStd)
76.Case(
"stack", IsInStd)
77.Case(
"queue", IsInStd)
97 auto*BoolExpr =
new(
Context)
99llvm::APSInt
Value{1};
140 if(RT->isRValueReferenceType()) {
144 Diag(
Range.getBegin(), diag::err_rref_in_exception_spec)
157 unsignedDiagID = diag::err_incomplete_in_exception_spec;
158 boolReturnValueOnError =
true;
160DiagID = diag::ext_incomplete_in_exception_spec;
161ReturnValueOnError =
false;
166 returnReturnValueOnError;
170 Diag(
Range.getBegin(), diag::err_wasm_reftype_exception_spec);
177 Diag(
Range.getBegin(), diag::err_sizeless_in_exception_spec)
178<< (
Kind== 2 ? 1 : 0) << PointeeT <<
Range;
208 Diag(
Loc, diag::err_exception_spec_not_parsed);
232 Diag(
Loc, diag::err_exception_spec_not_parsed);
244Listener->ResolvedExceptionSpec(FD);
258 returnDC->
isRecord() && cast<RecordDecl>(DC)->isBeingDefined();
262Sema &S,
constPartialDiagnostic &DiagID,
constPartialDiagnostic &NoteID,
263 constFunctionProtoType *Old, SourceLocation OldLoc,
264 constFunctionProtoType *New, SourceLocation NewLoc,
265 bool*MissingExceptionSpecification =
nullptr,
266 bool*MissingEmptyExceptionSpecification =
nullptr,
267 boolAllowNoexceptAllMatchWithNoSpec =
false,
boolIsOperatorNew =
false);
272 if(!isa<CXXDestructorDecl>(
Decl) &&
273 Decl->getDeclName().getCXXOverloadedOperator() != OO_Delete &&
274 Decl->getDeclName().getCXXOverloadedOperator() != OO_Array_Delete)
282 if(!
Decl->getTypeSourceInfo())
283 returnisa<CXXDestructorDecl>(
Decl);
297 boolIsOperatorNew = OO == OO_New || OO == OO_Array_New;
298 boolMissingExceptionSpecification =
false;
299 boolMissingEmptyExceptionSpecification =
false;
301 unsignedDiagID = diag::err_mismatched_exception_spec;
302 boolReturnValueOnError =
true;
304DiagID = diag::ext_mismatched_exception_spec;
305ReturnValueOnError =
false;
319*
this,
PDiag(DiagID),
PDiag(diag::note_previous_declaration),
322&MissingExceptionSpecification, &MissingEmptyExceptionSpecification,
323 true, IsOperatorNew)) {
330 Diag(New->
getLocation(), diag::ext_implicit_exception_spec_mismatch)
340 if(!MissingExceptionSpecification)
341 returnReturnValueOnError;
353 if(MissingEmptyExceptionSpecification &&
359NewProto->getReturnType(), NewProto->getParamTypes(),
386NewProto->getReturnType(), NewProto->getParamTypes(),
387NewProto->getExtProtoInfo().withExceptionSpec(ESI)));
391DiagID = diag::ext_missing_exception_specification;
392ReturnValueOnError =
false;
397DiagID = diag::ext_missing_exception_specification;
398ReturnValueOnError =
false;
406DiagID = diag::ext_missing_exception_specification;
407ReturnValueOnError =
false;
409DiagID = diag::err_missing_exception_specification;
410ReturnValueOnError =
true;
415llvm::raw_svector_ostream
OS(ExceptionSpecString);
416 switch(OldProto->getExceptionSpecType()) {
423 boolOnFirstException =
true;
424 for(
const auto&
E: OldProto->exceptions()) {
425 if(OnFirstException)
426OnFirstException =
false;
444assert(OldProto->getNoexceptExpr() !=
nullptr&&
"Expected non-null Expr");
449 OS<<
"__attribute__((nothrow))";
456llvm_unreachable(
"This spec type is compatible with none.");
465 if(!FTLoc.getTypePtr()->hasTrailingReturn())
481 returnReturnValueOnError;
490 unsignedDiagID = diag::err_mismatched_exception_spec;
492DiagID = diag::ext_mismatched_exception_spec;
494*
this,
PDiag(DiagID),
PDiag(diag::note_previous_declaration),
495Old, OldLoc, New, NewLoc);
513 bool*MissingExceptionSpecification,
514 bool*MissingEmptyExceptionSpecification,
515 boolAllowNoexceptAllMatchWithNoSpec,
boolIsOperatorNew) {
516 if(MissingExceptionSpecification)
517*MissingExceptionSpecification =
false;
519 if(MissingEmptyExceptionSpecification)
520*MissingEmptyExceptionSpecification =
false;
553 "Shouldn't see unknown exception specifications here");
567 if(!AllowNoexceptAllMatchWithNoSpec &&
580llvm::FoldingSetNodeID OldFSN, NewFSN;
583 if(OldFSN == NewFSN)
599 if(OldTypes.count(TypePtr))
600NewTypes.insert(TypePtr);
607 if(
Success&& OldTypes.size() == NewTypes.size())
614 if(S.
getLangOpts().CPlusPlus11 && IsOperatorNew) {
617WithExceptions = New;
619WithExceptions = Old;
626 if(Name && Name->getName() ==
"bad_alloc") {
628 if(ExRecord->isInStdNamespace()) {
638 if(MissingExceptionSpecification && OldEST !=
EST_None&&
642*MissingExceptionSpecification =
true;
644 if(MissingEmptyExceptionSpecification && OldCanThrow ==
CT_Cannot) {
648*MissingEmptyExceptionSpecification =
true;
654S.
Diag(NewLoc, DiagID);
656S.
Diag(OldLoc, NoteID);
749llvm_unreachable(
"access check dependent for unprivileged context");
751llvm_unreachable(
"access check delayed in non-declaration");
753llvm_unreachable(
"unexpected access check result");
785 "Shouldn't see unknown exception specifications here");
802SkipSupersetFirstParameter, SuperLoc, Subset,
803SkipSubsetFirstParameter, SubLoc);
809 Diag(SubLoc, NoThrowDiagID);
811 Diag(SuperLoc, NoteID);
819 Diag(SubLoc, DiagID);
821 Diag(SuperLoc, NoteID);
826 "Exception spec subset: non-dynamic case slipped through.");
831SubI = RefTy->getPointeeType();
834 boolContained =
false;
848 Diag(SubLoc, DiagID);
850 Diag(SuperLoc, NoteID);
856SkipSupersetFirstParameter, SuperLoc, Subset,
857SkipSupersetFirstParameter, SubLoc);
881 autoRetDiag = DiagID;
884*
this, RetDiag,
PDiag(),
891assert((
Target->getNumParams() - (
unsigned)SkipTargetFirstParameter) ==
892(Source->
getNumParams() - (
unsigned)SkipSourceFirstParameter) &&
893 "Functions have different argument counts.");
894 for(
unsignedi = 0,
E=
Target->getNumParams(); i !=
E; ++i) {
895 autoParamDiag = DiagID;
898*
this, ParamDiag,
PDiag(),
899 Target->getParamType(i + (SkipTargetFirstParameter ? 1 : 0)),
900TargetLoc, Source->
getParamType(SkipSourceFirstParameter ? 1 : 0),
919 unsignedDiagID = diag::err_incompatible_exception_specs;
920 unsignedNestedDiagID = diag::err_deep_exception_specs_differ;
925DiagID = diag::warn_incompatible_exception_specs;
926NestedDiagID = diag::warn_deep_exception_specs_differ;
970 unsignedDiagID = diag::err_override_exception_spec;
972DiagID = diag::ext_override_exception_spec;
974 PDiag(DiagID),
PDiag(diag::err_deep_exception_specs_differ),
975 PDiag(diag::note_overridden_virtual_function),
976 PDiag(diag::ext_override_exception_spec),
985 for(
const Stmt*SubStmt : S->children()) {
999 if(isa_and_nonnull<FunctionDecl>(
D) &&
D->hasAttr<NoThrowAttr>())
1005 if(S.getLangOpts().CPlusPlus17 && isa_and_nonnull<CallExpr>(
E)) {
1006 E= cast<CallExpr>(
E)->getCallee();
1011 E=
E->IgnoreParenImpCasts();
1014 if(
auto*Op = dyn_cast<BinaryOperator>(
E)) {
1015assert(Op->getOpcode() == BO_PtrMemD || Op->getOpcode() == BO_PtrMemI);
1016 T= Op->getRHS()->getType()
1019 T= cast<MemberExpr>(
E)->getMemberDecl()->getType();
1022}
else if(
const ValueDecl*VD = dyn_cast_or_null<ValueDecl>(
D))
1042 if(
Loc.isValid() || (
Loc.isInvalid() &&
E))
1043FT = S.ResolveExceptionSpec(
Loc.isInvalid() ?
E->getBeginLoc() :
Loc, FT);
1062 if(
auto*Dtor = RD->getDestructor()) {
1070 if(
auto*DD = dyn_cast<DecompositionDecl>(VD))
1071 for(
auto*B : DD->flat_bindings())
1072 if(
auto*HD = B->getHoldingVar())
1114 switch(S->getStmtClass()) {
1115 caseExpr::ConstantExprClass:
1116 return canThrow(cast<ConstantExpr>(S)->getSubExpr());
1118 caseExpr::CXXThrowExprClass:
1122 caseExpr::CXXDynamicCastExprClass: {
1125 auto*CE = cast<CXXDynamicCastExpr>(S);
1127 if(CE->getType()->isVariablyModifiedType())
1135 caseExpr::CXXTypeidExprClass:
1144 caseExpr::CallExprClass:
1145 caseExpr::CXXMemberCallExprClass:
1146 caseExpr::CXXOperatorCallExprClass:
1147 caseExpr::UserDefinedLiteralClass: {
1148 const CallExpr*CE = cast<CallExpr>(S);
1161 caseExpr::CXXConstructExprClass:
1162 caseExpr::CXXTemporaryObjectExprClass: {
1163 auto*CE = cast<CXXConstructExpr>(S);
1165 if(CE->getType()->isVariablyModifiedType())
1173 caseExpr::CXXInheritedCtorInitExprClass: {
1174 auto*ICIE = cast<CXXInheritedCtorInitExpr>(S);
1178 caseExpr::LambdaExprClass: {
1179 const LambdaExpr*Lambda = cast<LambdaExpr>(S);
1184Cap != CapEnd; ++Cap)
1189 caseExpr::CXXNewExprClass: {
1190 auto*NE = cast<CXXNewExpr>(S);
1192 if(NE->isTypeDependent())
1201 caseExpr::CXXDeleteExprClass: {
1202 auto*DE = cast<CXXDeleteExpr>(S);
1204 QualTypeDTy = DE->getDestroyedType();
1213 const FunctionDecl*OperatorDelete = DE->getOperatorDelete();
1230 caseExpr::CXXBindTemporaryExprClass: {
1231 auto*BTE = cast<CXXBindTemporaryExpr>(S);
1234 canCalleeThrow(*
this, BTE, BTE->getTemporary()->getDestructor());
1240 caseExpr::PseudoObjectExprClass: {
1241 auto*POE = cast<PseudoObjectExpr>(S);
1243 for(
const Expr*
E: POE->semantics()) {
1253 caseExpr::ObjCMessageExprClass:
1254 caseExpr::ObjCPropertyRefExprClass:
1255 caseExpr::ObjCSubscriptRefExprClass:
1261 caseExpr::ObjCArrayLiteralClass:
1262 caseExpr::ObjCDictionaryLiteralClass:
1263 caseExpr::ObjCBoxedExprClass:
1268 caseExpr::CoawaitExprClass:
1269 caseExpr::ConditionalOperatorClass:
1270 caseExpr::CoyieldExprClass:
1271 caseExpr::CXXRewrittenBinaryOperatorClass:
1272 caseExpr::CXXStdInitializerListExprClass:
1273 caseExpr::DesignatedInitExprClass:
1274 caseExpr::DesignatedInitUpdateExprClass:
1275 caseExpr::ExprWithCleanupsClass:
1276 caseExpr::ExtVectorElementExprClass:
1277 caseExpr::InitListExprClass:
1278 caseExpr::ArrayInitLoopExprClass:
1279 caseExpr::MemberExprClass:
1280 caseExpr::ObjCIsaExprClass:
1281 caseExpr::ObjCIvarRefExprClass:
1282 caseExpr::ParenExprClass:
1283 caseExpr::ParenListExprClass:
1284 caseExpr::ShuffleVectorExprClass:
1285 caseExpr::StmtExprClass:
1286 caseExpr::ConvertVectorExprClass:
1287 caseExpr::VAArgExprClass:
1288 caseExpr::CXXParenListInitExprClass:
1289 caseExpr::ResolvedUnexpandedPackExprClass:
1292 caseExpr::CompoundLiteralExprClass:
1293 caseExpr::CXXConstCastExprClass:
1294 caseExpr::CXXAddrspaceCastExprClass:
1295 caseExpr::CXXReinterpretCastExprClass:
1296 caseExpr::BuiltinBitCastExprClass:
1298 if(cast<Expr>(S)->getType()->isVariablyModifiedType())
1303 caseExpr::ArraySubscriptExprClass:
1304 caseExpr::MatrixSubscriptExprClass:
1305 caseExpr::ArraySectionExprClass:
1306 caseExpr::OMPArrayShapingExprClass:
1307 caseExpr::OMPIteratorExprClass:
1308 caseExpr::BinaryOperatorClass:
1309 caseExpr::DependentCoawaitExprClass:
1310 caseExpr::CompoundAssignOperatorClass:
1311 caseExpr::CStyleCastExprClass:
1312 caseExpr::CXXStaticCastExprClass:
1313 caseExpr::CXXFunctionalCastExprClass:
1314 caseExpr::ImplicitCastExprClass:
1315 caseExpr::MaterializeTemporaryExprClass:
1316 caseExpr::UnaryOperatorClass: {
1318 if(
auto*CE = dyn_cast<CastExpr>(S))
1319 if(CE->getType()->isVariablyModifiedType())
1326 caseExpr::CXXDefaultArgExprClass:
1327 return canThrow(cast<CXXDefaultArgExpr>(S)->getExpr());
1329 caseExpr::CXXDefaultInitExprClass:
1330 return canThrow(cast<CXXDefaultInitExpr>(S)->getExpr());
1332 caseExpr::ChooseExprClass: {
1333 auto*CE = cast<ChooseExpr>(S);
1334 if(CE->isTypeDependent() || CE->isValueDependent())
1336 return canThrow(CE->getChosenSubExpr());
1339 caseExpr::GenericSelectionExprClass:
1340 if(cast<GenericSelectionExpr>(S)->isResultDependent())
1342 return canThrow(cast<GenericSelectionExpr>(S)->getResultExpr());
1345 caseExpr::CXXDependentScopeMemberExprClass:
1346 caseExpr::CXXUnresolvedConstructExprClass:
1347 caseExpr::DependentScopeDeclRefExprClass:
1348 caseExpr::CXXFoldExprClass:
1349 caseExpr::RecoveryExprClass:
1352 caseExpr::AsTypeExprClass:
1353 caseExpr::BinaryConditionalOperatorClass:
1354 caseExpr::BlockExprClass:
1355 caseExpr::CUDAKernelCallExprClass:
1356 caseExpr::DeclRefExprClass:
1357 caseExpr::ObjCBridgedCastExprClass:
1358 caseExpr::ObjCIndirectCopyRestoreExprClass:
1359 caseExpr::ObjCProtocolExprClass:
1360 caseExpr::ObjCSelectorExprClass:
1361 caseExpr::ObjCAvailabilityCheckExprClass:
1362 caseExpr::OffsetOfExprClass:
1363 caseExpr::PackExpansionExprClass:
1364 caseExpr::SubstNonTypeTemplateParmExprClass:
1365 caseExpr::SubstNonTypeTemplateParmPackExprClass:
1366 caseExpr::FunctionParmPackExprClass:
1367 caseExpr::UnaryExprOrTypeTraitExprClass:
1368 caseExpr::UnresolvedLookupExprClass:
1369 caseExpr::UnresolvedMemberExprClass:
1370 caseExpr::TypoExprClass:
1374 caseExpr::AddrLabelExprClass:
1375 caseExpr::ArrayTypeTraitExprClass:
1376 caseExpr::AtomicExprClass:
1377 caseExpr::TypeTraitExprClass:
1378 caseExpr::CXXBoolLiteralExprClass:
1379 caseExpr::CXXNoexceptExprClass:
1380 caseExpr::CXXNullPtrLiteralExprClass:
1381 caseExpr::CXXPseudoDestructorExprClass:
1382 caseExpr::CXXScalarValueInitExprClass:
1383 caseExpr::CXXThisExprClass:
1384 caseExpr::CXXUuidofExprClass:
1385 caseExpr::CharacterLiteralClass:
1386 caseExpr::ExpressionTraitExprClass:
1387 caseExpr::FloatingLiteralClass:
1388 caseExpr::GNUNullExprClass:
1389 caseExpr::ImaginaryLiteralClass:
1390 caseExpr::ImplicitValueInitExprClass:
1391 caseExpr::IntegerLiteralClass:
1392 caseExpr::FixedPointLiteralClass:
1393 caseExpr::ArrayInitIndexExprClass:
1394 caseExpr::NoInitExprClass:
1395 caseExpr::ObjCEncodeExprClass:
1396 caseExpr::ObjCStringLiteralClass:
1397 caseExpr::ObjCBoolLiteralExprClass:
1398 caseExpr::OpaqueValueExprClass:
1399 caseExpr::PredefinedExprClass:
1400 caseExpr::SizeOfPackExprClass:
1401 caseExpr::PackIndexingExprClass:
1402 caseExpr::StringLiteralClass:
1403 caseExpr::SourceLocExprClass:
1404 caseExpr::EmbedExprClass:
1405 caseExpr::ConceptSpecializationExprClass:
1406 caseExpr::RequiresExprClass:
1407 caseExpr::HLSLOutArgExprClass:
1408 caseStmt::OpenACCEnterDataConstructClass:
1409 caseStmt::OpenACCExitDataConstructClass:
1410 caseStmt::OpenACCWaitConstructClass:
1411 caseStmt::OpenACCInitConstructClass:
1412 caseStmt::OpenACCShutdownConstructClass:
1413 caseStmt::OpenACCSetConstructClass:
1414 caseStmt::OpenACCUpdateConstructClass:
1418 caseExpr::MSPropertyRefExprClass:
1419 caseExpr::MSPropertySubscriptExprClass:
1420llvm_unreachable(
"Invalid class for expression");
1423 caseStmt::OpenACCComputeConstructClass:
1424 caseStmt::OpenACCLoopConstructClass:
1425 caseStmt::OpenACCCombinedConstructClass:
1426 caseStmt::OpenACCDataConstructClass:
1427 caseStmt::OpenACCHostDataConstructClass:
1428 caseStmt::AttributedStmtClass:
1429 caseStmt::BreakStmtClass:
1430 caseStmt::CapturedStmtClass:
1431 caseStmt::SYCLKernelCallStmtClass:
1432 caseStmt::CaseStmtClass:
1433 caseStmt::CompoundStmtClass:
1434 caseStmt::ContinueStmtClass:
1435 caseStmt::CoreturnStmtClass:
1436 caseStmt::CoroutineBodyStmtClass:
1437 caseStmt::CXXCatchStmtClass:
1438 caseStmt::CXXForRangeStmtClass:
1439 caseStmt::DefaultStmtClass:
1440 caseStmt::DoStmtClass:
1441 caseStmt::ForStmtClass:
1442 caseStmt::GCCAsmStmtClass:
1443 caseStmt::GotoStmtClass:
1444 caseStmt::IndirectGotoStmtClass:
1445 caseStmt::LabelStmtClass:
1446 caseStmt::MSAsmStmtClass:
1447 caseStmt::MSDependentExistsStmtClass:
1448 caseStmt::NullStmtClass:
1449 caseStmt::ObjCAtCatchStmtClass:
1450 caseStmt::ObjCAtFinallyStmtClass:
1451 caseStmt::ObjCAtSynchronizedStmtClass:
1452 caseStmt::ObjCAutoreleasePoolStmtClass:
1453 caseStmt::ObjCForCollectionStmtClass:
1454 caseStmt::OMPAtomicDirectiveClass:
1455 caseStmt::OMPAssumeDirectiveClass:
1456 caseStmt::OMPBarrierDirectiveClass:
1457 caseStmt::OMPCancelDirectiveClass:
1458 caseStmt::OMPCancellationPointDirectiveClass:
1459 caseStmt::OMPCriticalDirectiveClass:
1460 caseStmt::OMPDistributeDirectiveClass:
1461 caseStmt::OMPDistributeParallelForDirectiveClass:
1462 caseStmt::OMPDistributeParallelForSimdDirectiveClass:
1463 caseStmt::OMPDistributeSimdDirectiveClass:
1464 caseStmt::OMPFlushDirectiveClass:
1465 caseStmt::OMPDepobjDirectiveClass:
1466 caseStmt::OMPScanDirectiveClass:
1467 caseStmt::OMPForDirectiveClass:
1468 caseStmt::OMPForSimdDirectiveClass:
1469 caseStmt::OMPMasterDirectiveClass:
1470 caseStmt::OMPMasterTaskLoopDirectiveClass:
1471 caseStmt::OMPMaskedTaskLoopDirectiveClass:
1472 caseStmt::OMPMasterTaskLoopSimdDirectiveClass:
1473 caseStmt::OMPMaskedTaskLoopSimdDirectiveClass:
1474 caseStmt::OMPOrderedDirectiveClass:
1475 caseStmt::OMPCanonicalLoopClass:
1476 caseStmt::OMPParallelDirectiveClass:
1477 caseStmt::OMPParallelForDirectiveClass:
1478 caseStmt::OMPParallelForSimdDirectiveClass:
1479 caseStmt::OMPParallelMasterDirectiveClass:
1480 caseStmt::OMPParallelMaskedDirectiveClass:
1481 caseStmt::OMPParallelMasterTaskLoopDirectiveClass:
1482 caseStmt::OMPParallelMaskedTaskLoopDirectiveClass:
1483 caseStmt::OMPParallelMasterTaskLoopSimdDirectiveClass:
1484 caseStmt::OMPParallelMaskedTaskLoopSimdDirectiveClass:
1485 caseStmt::OMPParallelSectionsDirectiveClass:
1486 caseStmt::OMPSectionDirectiveClass:
1487 caseStmt::OMPSectionsDirectiveClass:
1488 caseStmt::OMPSimdDirectiveClass:
1489 caseStmt::OMPTileDirectiveClass:
1490 caseStmt::OMPUnrollDirectiveClass:
1491 caseStmt::OMPReverseDirectiveClass:
1492 caseStmt::OMPInterchangeDirectiveClass:
1493 caseStmt::OMPSingleDirectiveClass:
1494 caseStmt::OMPTargetDataDirectiveClass:
1495 caseStmt::OMPTargetDirectiveClass:
1496 caseStmt::OMPTargetEnterDataDirectiveClass:
1497 caseStmt::OMPTargetExitDataDirectiveClass:
1498 caseStmt::OMPTargetParallelDirectiveClass:
1499 caseStmt::OMPTargetParallelForDirectiveClass:
1500 caseStmt::OMPTargetParallelForSimdDirectiveClass:
1501 caseStmt::OMPTargetSimdDirectiveClass:
1502 caseStmt::OMPTargetTeamsDirectiveClass:
1503 caseStmt::OMPTargetTeamsDistributeDirectiveClass:
1504 caseStmt::OMPTargetTeamsDistributeParallelForDirectiveClass:
1505 caseStmt::OMPTargetTeamsDistributeParallelForSimdDirectiveClass:
1506 caseStmt::OMPTargetTeamsDistributeSimdDirectiveClass:
1507 caseStmt::OMPTargetUpdateDirectiveClass:
1508 caseStmt::OMPScopeDirectiveClass:
1509 caseStmt::OMPTaskDirectiveClass:
1510 caseStmt::OMPTaskgroupDirectiveClass:
1511 caseStmt::OMPTaskLoopDirectiveClass:
1512 caseStmt::OMPTaskLoopSimdDirectiveClass:
1513 caseStmt::OMPTaskwaitDirectiveClass:
1514 caseStmt::OMPTaskyieldDirectiveClass:
1515 caseStmt::OMPErrorDirectiveClass:
1516 caseStmt::OMPTeamsDirectiveClass:
1517 caseStmt::OMPTeamsDistributeDirectiveClass:
1518 caseStmt::OMPTeamsDistributeParallelForDirectiveClass:
1519 caseStmt::OMPTeamsDistributeParallelForSimdDirectiveClass:
1520 caseStmt::OMPTeamsDistributeSimdDirectiveClass:
1521 caseStmt::OMPInteropDirectiveClass:
1522 caseStmt::OMPDispatchDirectiveClass:
1523 caseStmt::OMPMaskedDirectiveClass:
1524 caseStmt::OMPMetaDirectiveClass:
1525 caseStmt::OMPGenericLoopDirectiveClass:
1526 caseStmt::OMPTeamsGenericLoopDirectiveClass:
1527 caseStmt::OMPTargetTeamsGenericLoopDirectiveClass:
1528 caseStmt::OMPParallelGenericLoopDirectiveClass:
1529 caseStmt::OMPTargetParallelGenericLoopDirectiveClass:
1530 caseStmt::ReturnStmtClass:
1531 caseStmt::SEHExceptStmtClass:
1532 caseStmt::SEHFinallyStmtClass:
1533 caseStmt::SEHLeaveStmtClass:
1534 caseStmt::SEHTryStmtClass:
1535 caseStmt::SwitchStmtClass:
1536 caseStmt::WhileStmtClass:
1539 caseStmt::DeclStmtClass: {
1541 for(
const Decl*
D: cast<DeclStmt>(S)->decls()) {
1542 if(
auto*VD = dyn_cast<VarDecl>(
D))
1546 if(
auto*TND = dyn_cast<TypedefNameDecl>(
D))
1547 if(TND->getUnderlyingType()->isVariablyModifiedType())
1549 if(
auto*VD = dyn_cast<ValueDecl>(
D))
1550 if(VD->getType()->isVariablyModifiedType())
1556 caseStmt::IfStmtClass: {
1557 auto*IS = cast<IfStmt>(S);
1559 if(
const Stmt*
Init= IS->getInit())
1561 if(
const Stmt*CondDS = IS->getConditionVariableDeclStmt())
1567 if(std::optional<const Stmt *> Case = IS->getNondiscardedCase(
Context))
1581 caseStmt::CXXTryStmtClass: {
1582 auto*TS = cast<CXXTryStmt>(S);
1585 const CXXCatchStmt*FinalHandler = TS->getHandler(TS->getNumHandlers() - 1);
1591 caseStmt::ObjCAtThrowStmtClass:
1594 caseStmt::ObjCAtTryStmtClass: {
1595 auto*TS = cast<ObjCAtTryStmt>(S);
1600 if(
const Stmt*Finally = TS->getFinallyStmt())
1602 for(
unsignedI = TS->getNumCatchStmts(); I != 0; --I) {
1614 caseStmt::SYCLUniqueStableNameExprClass:
1616 caseStmt::OpenACCAsteriskSizeExprClass:
1619llvm_unreachable(
"Invalid class for statement");
1621llvm_unreachable(
"Bogus StmtClass");
Defines the Diagnostic-related interfaces.
enum clang::sema::@1704::IndirectLocalPathEntry::EntryKind Kind
Defines the clang::Expr interface and subclasses for C++ expressions.
llvm::MachO::Target Target
Defines the SourceManager interface.
Defines the Objective-C statement AST node classes.
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],...
SourceManager & getSourceManager()
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated,...
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals) const
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals.
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
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.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
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.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
SourceLocation getLocation() const
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
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 * 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.
bool isReplaceableGlobalAllocationFunction(std::optional< unsigned > *AlignmentParam=nullptr, bool *IsNothrow=nullptr) const
Determines whether this function is one of the replaceable global allocation functions: void *operato...
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 getNumParams() const
QualType getParamType(unsigned i) const
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...
QualType getReturnType() const
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.
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.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
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.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeType() const
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial 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.
void EvaluateImplicitExceptionSpec(SourceLocation Loc, FunctionDecl *FD)
Evaluate the implicit exception specification for a defaulted special member function.
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
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...
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
const LangOptions & getLangOpts() const
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
ExprResult ActOnNoexceptSpec(Expr *NoexceptExpr, ExceptionSpecificationType &EST)
Check the given noexcept-specifier, convert its expression, and compute the appropriate ExceptionSpec...
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 ...
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...
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
CanThrowResult canThrow(const Stmt *E)
@ CCEK_Noexcept
Condition in a noexcept(bool) specifier.
bool handlerCanCatch(QualType HandlerType, QualType ExceptionType)
bool CheckDistantExceptionSpec(QualType T)
CheckDistantExceptionSpec - Check if the given type is a pointer or pointer to member to a function w...
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)
bool CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionExceptionSpec - Checks whether the exception spec is a subset of base spec.
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
bool IsFunctionConversion(QualType FromType, QualType ToType, QualType &ResultTy)
Determine whether the conversion from FromType to ToType is a valid conversion that strips "noexcept"...
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.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
A trivial tuple used to represent a source range.
SourceLocation getBegin() const
Stmt - This represents one statement.
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
bool isDependentType() const
Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...
bool isBeingDefined() const
Determines whether this type is in the process of being defined.
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...
bool isPointerType() const
const T * castAs() const
Member-template castAs<specific type>.
bool isSpecificPlaceholderType(unsigned K) const
Test for a specific placeholder type.
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.
bool isFunctionType() const
const T * getAs() const
Member-template getAs<specific type>'.
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 ...
void setType(QualType newType)
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.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
CanThrowResult
Possible results from evaluation of a noexcept expression.
static const FunctionProtoType * GetUnderlyingFunction(QualType T)
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.
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
static bool hasImplicitExceptionSpec(FunctionDecl *Decl)
Determine whether a function has an implicitly-generated exception specification.
@ 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)
static CanThrowResult canDynamicCastThrow(const CXXDynamicCastExpr *DC)
static CanThrowResult canSubStmtsThrow(Sema &Self, const Stmt *S)
const FunctionProtoType * T
static CanThrowResult canTypeidThrow(Sema &S, const CXXTypeidExpr *DC)
static bool CheckSpecForTypesEquivalent(Sema &S, const PartialDiagnostic &DiagID, const PartialDiagnostic &NoteID, QualType Target, SourceLocation TargetLoc, QualType Source, SourceLocation SourceLoc)
@ Success
Template argument deduction was successful.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_DependentNoexcept
noexcept(expression), value-dependent
@ EST_DynamicNone
throw()
@ 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)
Holds information about the various types of exception specification.
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4