@@ -3048,13 +3048,16 @@ namespace {
30483048
30493049 if (auto recordType = dyn_cast<clang::RecordType>(
30503050 decl->getReturnType ().getCanonicalType ())) {
3051- Impl.addImportDiagnostic (
3052- decl, Diagnostic (diag::reference_passed_by_value,
3053- Impl.SwiftContext .AllocateCopy (
3054- recordType->getDecl ()->getNameAsString ()),
3055- " the return" ),
3056- decl->getLocation ());
3057- return recordHasReferenceSemantics (recordType->getDecl ());
3051+ if (recordHasReferenceSemantics (recordType->getDecl ())) {
3052+ Impl.addImportDiagnostic (
3053+ decl,
3054+ Diagnostic (diag::reference_passed_by_value,
3055+ Impl.SwiftContext .AllocateCopy (
3056+ recordType->getDecl ()->getNameAsString ()),
3057+ " the return" ),
3058+ decl->getLocation ());
3059+ return true ;
3060+ }
30583061 }
30593062
30603063 return false ;
@@ -3391,6 +3394,14 @@ namespace {
33913394 func->setAccess (AccessLevel::Public);
33923395 }
33933396
3397+ if (!isa<clang::CXXConstructorDecl>(decl) && !importedType) {
3398+ if (!Impl.importFunctionReturnType (decl, result->getDeclContext ())) {
3399+ Impl.addImportDiagnostic (
3400+ decl, Diagnostic (diag::unsupported_return_type, decl),
3401+ decl->getSourceRange ().getBegin ());
3402+ return nullptr ;
3403+ }
3404+ }
33943405 result->setIsObjC (false );
33953406 result->setIsDynamic (false );
33963407
0 commit comments