@@ -1282,6 +1282,7 @@ static bool canBridgeTypes(ImportTypeKind importKind) {
1282
1282
case ImportTypeKind::Result:
1283
1283
case ImportTypeKind::AuditedResult:
1284
1284
case ImportTypeKind::Parameter:
1285
+ case ImportTypeKind::CompletionHandlerParameter:
1285
1286
case ImportTypeKind::CompletionHandlerResultParameter:
1286
1287
case ImportTypeKind::Property:
1287
1288
case ImportTypeKind::PropertyWithReferenceSemantics:
@@ -1308,6 +1309,7 @@ static bool isCFAudited(ImportTypeKind importKind) {
1308
1309
case ImportTypeKind::AuditedVariable:
1309
1310
case ImportTypeKind::AuditedResult:
1310
1311
case ImportTypeKind::Parameter:
1312
+ case ImportTypeKind::CompletionHandlerParameter:
1311
1313
case ImportTypeKind::CompletionHandlerResultParameter:
1312
1314
case ImportTypeKind::Property:
1313
1315
case ImportTypeKind::PropertyWithReferenceSemantics:
@@ -2299,11 +2301,6 @@ ImportedType ClangImporter::Implementation::importFunctionParamsAndReturnType(
2299
2301
return {swiftResultTy, importedType.isImplicitlyUnwrapped ()};
2300
2302
}
2301
2303
2302
- static ImportTypeKind
2303
- getImportTypeKindForParam (const clang::ParmVarDecl *param) {
2304
- return ImportTypeKind::Parameter;
2305
- }
2306
-
2307
2304
llvm::Optional<ClangImporter::Implementation::ImportParameterTypeResult>
2308
2305
ClangImporter::Implementation::importParameterType (
2309
2306
const clang::ParmVarDecl *param, OptionalTypeKind optionalityOfParam,
@@ -2316,7 +2313,9 @@ ClangImporter::Implementation::importParameterType(
2316
2313
if (auto elaborated = dyn_cast<clang::ElaboratedType>(paramTy))
2317
2314
paramTy = elaborated->desugar ();
2318
2315
2319
- ImportTypeKind importKind = getImportTypeKindForParam (param);
2316
+ ImportTypeKind importKind = paramIsCompletionHandler
2317
+ ? ImportTypeKind::CompletionHandlerParameter
2318
+ : ImportTypeKind::Parameter;
2320
2319
2321
2320
// Import the parameter type into Swift.
2322
2321
auto attrs = getImportTypeAttrs (param, /* isParam=*/ true );
@@ -3204,17 +3203,16 @@ ImportedType ClangImporter::Implementation::importMethodParamsAndReturnType(
3204
3203
decomposeCompletionHandlerType (swiftParamTy, *asyncInfo)) {
3205
3204
swiftResultTy = replacedSwiftResultTy;
3206
3205
3207
- ImportTypeKind importKind = getImportTypeKindForParam (param);
3208
-
3209
3206
// Import the original completion handler type without adjustments.
3210
3207
Type origSwiftParamTy =
3211
- importType (paramTy, importKind, paramAddDiag,
3212
- allowNSUIntegerAsIntInParam, Bridgeability::Full,
3213
- ImportTypeAttrs (), optionalityOfParam,
3208
+ importType (paramTy, ImportTypeKind::CompletionHandlerParameter,
3209
+ paramAddDiag, allowNSUIntegerAsIntInParam,
3210
+ Bridgeability::Full, ImportTypeAttrs (),
3211
+ optionalityOfParam,
3214
3212
/* resugarNSErrorPointer=*/ !paramIsError, llvm::None)
3215
3213
.getType ();
3216
- completionHandlerType = mapGenericArgs (origDC, dc, origSwiftParamTy)
3217
- ->getCanonicalType ();
3214
+ completionHandlerType =
3215
+ mapGenericArgs (origDC, dc, origSwiftParamTy) ->getCanonicalType ();
3218
3216
continue ;
3219
3217
}
3220
3218
0 commit comments