@@ -1633,10 +1633,13 @@ static ImportedType adjustTypeForConcreteImport(
16331633 return {importedType, isIUO};
16341634}
16351635
1636- static void applyTypeAttributes (ImportTypeKind importKind,
1636+ static void applyTypeAttributes (ASTContext &SwiftContext,
1637+ ImportTypeKind importKind,
16371638 ImportTypeAttrs &attrs, clang::QualType type) {
16381639 bool isMainActor = false ;
1639- bool isSendable = false ;
1640+ bool isSendable =
1641+ SwiftContext.LangOpts .hasFeature (Feature::SendableCompletionHandlers) &&
1642+ importKind == ImportTypeKind::CompletionHandlerParameter;
16401643 bool isNonSendable = false ;
16411644
16421645 std::function<clang::QualType (clang::QualType)> skipUnrelatedSugar =
@@ -1725,7 +1728,7 @@ ImportedType ClangImporter::Implementation::importType(
17251728 optionality = translateNullability (*nullability, stripNonResultOptionality);
17261729 }
17271730
1728- applyTypeAttributes (importKind, attrs, type);
1731+ applyTypeAttributes (SwiftContext, importKind, attrs, type);
17291732
17301733 // If this is a completion handler parameter, record the function type whose
17311734 // parameters will act as the results of the completion handler.
@@ -2048,14 +2051,10 @@ class GetSendableType :
20482051
20492052} // anonymous namespace
20502053
2051- ImportTypeAttrs swift::getImportTypeAttrs (const clang::Decl *D, bool isParam,
2052- bool sendableByDefault) {
2054+ ImportTypeAttrs swift::getImportTypeAttrs (const clang::Decl *D, bool isParam) {
20532055 ImportTypeAttrs attrs;
20542056
2055- if (sendableByDefault)
2056- attrs |= ImportTypeAttr::DefaultsToSendable;
2057-
2058- bool sendableRequested = sendableByDefault;
2057+ bool sendableRequested = false ;
20592058 bool sendableDisqualified = false ;
20602059
20612060 if (D->hasAttrs ()) {
@@ -2477,12 +2476,6 @@ ClangImporter::Implementation::importParameterType(
24772476 }
24782477
24792478 if (!swiftParamTy) {
2480- bool sendableByDefault =
2481- paramIsCompletionHandler &&
2482- SwiftContext.LangOpts .hasFeature (Feature::SendableCompletionHandlers);
2483-
2484- auto attrs = getImportTypeAttrs (param, /* isParam=*/ true , sendableByDefault);
2485-
24862479 // If this is the throws error parameter, we don't need to convert any
24872480 // NSError** arguments to the sugared NSErrorPointer typealias form,
24882481 // because all that is done with it is retrieving the canonical
0 commit comments