@@ -3064,13 +3064,16 @@ namespace {
30643064
30653065 if (auto recordType = dyn_cast<clang::RecordType>(
30663066 decl->getReturnType ().getCanonicalType ())) {
3067- Impl.addImportDiagnostic (
3068- decl, Diagnostic (diag::reference_passed_by_value,
3069- Impl.SwiftContext .AllocateCopy (
3070- recordType->getDecl ()->getNameAsString ()),
3071- " the return" ),
3072- decl->getLocation ());
3073- return recordHasReferenceSemantics (recordType->getDecl ());
3067+ if (recordHasReferenceSemantics (recordType->getDecl ())) {
3068+ Impl.addImportDiagnostic (
3069+ decl,
3070+ Diagnostic (diag::reference_passed_by_value,
3071+ Impl.SwiftContext .AllocateCopy (
3072+ recordType->getDecl ()->getNameAsString ()),
3073+ " the return" ),
3074+ decl->getLocation ());
3075+ return true ;
3076+ }
30743077 }
30753078
30763079 return false ;
@@ -3407,6 +3410,14 @@ namespace {
34073410 func->setAccess (AccessLevel::Public);
34083411 }
34093412
3413+ if (!isa<clang::CXXConstructorDecl>(decl) && !importedType) {
3414+ if (!Impl.importFunctionReturnType (decl, result->getDeclContext ())) {
3415+ Impl.addImportDiagnostic (
3416+ decl, Diagnostic (diag::unsupported_return_type, decl),
3417+ decl->getSourceRange ().getBegin ());
3418+ return nullptr ;
3419+ }
3420+ }
34103421 result->setIsObjC (false );
34113422 result->setIsDynamic (false );
34123423
0 commit comments