[cxx-interop] [cxx-interop] Infer SWIFT_SHARED_REFERENCE for types inheriting from a C++ foreign reference type

rdar://97914474
This commit is contained in:
fahadnayyar
2024-11-07 09:36:07 -08:00
committed by Fahad Nayyar
parent c42268e7f1
commit d8f919778d
18 changed files with 810 additions and 102 deletions

View File

@@ -4206,8 +4206,10 @@ void MissingMemberFailure::diagnoseUnsafeCxxMethod(SourceLoc loc,
} else if (cxxMethod->getReturnType()->isRecordType()) {
if (auto cxxRecord = dyn_cast<clang::CXXRecordDecl>(
cxxMethod->getReturnType()->getAsRecordDecl())) {
// `importerImpl` is set to nullptr here to avoid diagnostics during
// this CxxRecordSemantics evaluation.
auto methodSemantics = evaluateOrDefault(
ctx.evaluator, CxxRecordSemantics({cxxRecord, ctx}), {});
ctx.evaluator, CxxRecordSemantics({cxxRecord, ctx, nullptr}), {});
if (methodSemantics == CxxRecordSemanticsKind::Iterator) {
ctx.Diags.diagnose(loc, diag::iterator_method_unavailable,
name.getBaseIdentifier().str());