@@ -1998,15 +1998,6 @@ ImportTypeAttrs swift::getImportTypeAttrs(const clang::Decl *D, bool isParam,
1998
1998
return attrs;
1999
1999
}
2000
2000
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
-
2010
2001
Type ClangImporter::Implementation::
2011
2002
applyImportTypeAttrs (ImportTypeAttrs attrs, Type type,
2012
2003
llvm::function_ref<void (Diagnostic &&)> addDiag) {
@@ -2221,6 +2212,7 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
2221
2212
importKind = ImportTypeKind::CFUnretainedOutParameter;
2222
2213
2223
2214
// Import the parameter type into Swift.
2215
+ ImportDiagnosticAdder paramAddDiag (*this , clangDecl, param->getLocation ());
2224
2216
Type swiftParamTy;
2225
2217
bool isParamTypeImplicitlyUnwrapped = false ;
2226
2218
bool isInOut = false ;
@@ -2254,9 +2246,7 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
2254
2246
if (!paramTy.isConstQualified ())
2255
2247
isInOut = true ;
2256
2248
}
2257
- auto importedType = importType (paramTy, importKind,
2258
- ImportDiagnosticAdder (*this , clangDecl,
2259
- param->getLocation ()),
2249
+ auto importedType = importType (paramTy, importKind, paramAddDiag,
2260
2250
allowNSUIntegerAsInt, Bridgeability::Full,
2261
2251
OptionalityOfParam);
2262
2252
if (!importedType) {
@@ -2271,8 +2261,8 @@ ParameterList *ClangImporter::Implementation::importFunctionParameterList(
2271
2261
}
2272
2262
2273
2263
// 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 );
2276
2266
2277
2267
// Figure out the name for this parameter.
2278
2268
Identifier bodyName = importFullName (param, CurrentVersion)
@@ -2878,8 +2868,9 @@ ImportedType ClangImporter::Implementation::importMethodParamsAndReturnType(
2878
2868
}
2879
2869
2880
2870
// 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);
2883
2874
2884
2875
// Figure out the name for this parameter.
2885
2876
Identifier bodyName = importFullName (param, CurrentVersion)
0 commit comments