@@ -1998,15 +1998,6 @@ ImportTypeAttrs swift::getImportTypeAttrs(const clang::Decl *D, bool isParam,
19981998 return attrs;
19991999}
20002000
2001- Type ClangImporter::Implementation::applyParamAttributes (
2002- const clang::ParmVarDecl *param, Type type, bool sendableByDefault) {
2003- auto parentDecl = cast<clang::Decl>(param->getDeclContext ());
2004- ImportDiagnosticAdder addDiag (*this , parentDecl, param->getLocation ());
2005-
2006- auto attrs = getImportTypeAttrs (param, /* isParam=*/ true , sendableByDefault);
2007- return applyImportTypeAttrs (attrs, type, addDiag);
2008- }
2009-
20102001Type ClangImporter::Implementation::
20112002applyImportTypeAttrs (ImportTypeAttrs attrs, Type type,
20122003 llvm::function_ref<void (Diagnostic &&)> addDiag) {
@@ -2221,6 +2212,7 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
22212212 importKind = ImportTypeKind::CFUnretainedOutParameter;
22222213
22232214 // Import the parameter type into Swift.
2215+ ImportDiagnosticAdder paramAddDiag (*this , clangDecl, param->getLocation ());
22242216 Type swiftParamTy;
22252217 bool isParamTypeImplicitlyUnwrapped = false ;
22262218 bool isInOut = false ;
@@ -2254,9 +2246,7 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
22542246 if (!paramTy.isConstQualified ())
22552247 isInOut = true ;
22562248 }
2257- auto importedType = importType (paramTy, importKind,
2258- ImportDiagnosticAdder (*this , clangDecl,
2259- param->getLocation ()),
2249+ auto importedType = importType (paramTy, importKind, paramAddDiag,
22602250 allowNSUIntegerAsInt, Bridgeability::Full,
22612251 OptionalityOfParam);
22622252 if (!importedType) {
@@ -2271,8 +2261,8 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
22712261 }
22722262
22732263 // Apply attributes to the type.
2274- swiftParamTy = applyParamAttributes (
2275- param , swiftParamTy, /* sendableByDefault= */ false );
2264+ auto attrs = getImportTypeAttrs (param, /* isParam= */ true );
2265+ swiftParamTy = applyImportTypeAttrs (attrs , swiftParamTy, paramAddDiag );
22762266
22772267 // Figure out the name for this parameter.
22782268 Identifier bodyName = importFullName (param, CurrentVersion)
@@ -2878,8 +2868,9 @@ ImportedType ClangImporter::Implementation::importMethodParamsAndReturnType(
28782868 }
28792869
28802870 // Apply Clang attributes to the parameter type.
2881- swiftParamTy = applyParamAttributes (param, swiftParamTy,
2882- /* sendableByDefault=*/ paramIsCompletionHandler);
2871+ auto attrs = getImportTypeAttrs (param, /* isParam=*/ true ,
2872+ /* sendableByDefault=*/ paramIsCompletionHandler);
2873+ swiftParamTy = applyImportTypeAttrs (attrs, swiftParamTy, paramAddDiag);
28832874
28842875 // Figure out the name for this parameter.
28852876 Identifier bodyName = importFullName (param, CurrentVersion)
0 commit comments