@@ -1282,6 +1282,7 @@ static bool canBridgeTypes(ImportTypeKind importKind) {
12821282 case ImportTypeKind::Result:
12831283 case ImportTypeKind::AuditedResult:
12841284 case ImportTypeKind::Parameter:
1285+ case ImportTypeKind::CompletionHandlerParameter:
12851286 case ImportTypeKind::CompletionHandlerResultParameter:
12861287 case ImportTypeKind::Property:
12871288 case ImportTypeKind::PropertyWithReferenceSemantics:
@@ -1308,6 +1309,7 @@ static bool isCFAudited(ImportTypeKind importKind) {
13081309 case ImportTypeKind::AuditedVariable:
13091310 case ImportTypeKind::AuditedResult:
13101311 case ImportTypeKind::Parameter:
1312+ case ImportTypeKind::CompletionHandlerParameter:
13111313 case ImportTypeKind::CompletionHandlerResultParameter:
13121314 case ImportTypeKind::Property:
13131315 case ImportTypeKind::PropertyWithReferenceSemantics:
@@ -2299,11 +2301,6 @@ ImportedType ClangImporter::Implementation::importFunctionParamsAndReturnType(
22992301 return {swiftResultTy, importedType.isImplicitlyUnwrapped ()};
23002302}
23012303
2302- static ImportTypeKind
2303- getImportTypeKindForParam (const clang::ParmVarDecl *param) {
2304- return ImportTypeKind::Parameter;
2305- }
2306-
23072304llvm::Optional<ClangImporter::Implementation::ImportParameterTypeResult>
23082305ClangImporter::Implementation::importParameterType (
23092306 const clang::ParmVarDecl *param, OptionalTypeKind optionalityOfParam,
@@ -2316,7 +2313,9 @@ ClangImporter::Implementation::importParameterType(
23162313 if (auto elaborated = dyn_cast<clang::ElaboratedType>(paramTy))
23172314 paramTy = elaborated->desugar ();
23182315
2319- ImportTypeKind importKind = getImportTypeKindForParam (param);
2316+ ImportTypeKind importKind = paramIsCompletionHandler
2317+ ? ImportTypeKind::CompletionHandlerParameter
2318+ : ImportTypeKind::Parameter;
23202319
23212320 // Import the parameter type into Swift.
23222321 auto attrs = getImportTypeAttrs (param, /* isParam=*/ true );
@@ -3204,17 +3203,16 @@ ImportedType ClangImporter::Implementation::importMethodParamsAndReturnType(
32043203 decomposeCompletionHandlerType (swiftParamTy, *asyncInfo)) {
32053204 swiftResultTy = replacedSwiftResultTy;
32063205
3207- ImportTypeKind importKind = getImportTypeKindForParam (param);
3208-
32093206 // Import the original completion handler type without adjustments.
32103207 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,
32143212 /* resugarNSErrorPointer=*/ !paramIsError, llvm::None)
32153213 .getType ();
3216- completionHandlerType = mapGenericArgs (origDC, dc, origSwiftParamTy)
3217- ->getCanonicalType ();
3214+ completionHandlerType =
3215+ mapGenericArgs (origDC, dc, origSwiftParamTy) ->getCanonicalType ();
32183216 continue ;
32193217 }
32203218
0 commit comments