@@ -1633,10 +1633,13 @@ static ImportedType adjustTypeForConcreteImport(
1633
1633
return {importedType, isIUO};
1634
1634
}
1635
1635
1636
- static void applyTypeAttributes (ImportTypeKind importKind,
1636
+ static void applyTypeAttributes (ASTContext &SwiftContext,
1637
+ ImportTypeKind importKind,
1637
1638
ImportTypeAttrs &attrs, clang::QualType type) {
1638
1639
bool isMainActor = false ;
1639
- bool isSendable = false ;
1640
+ bool isSendable =
1641
+ SwiftContext.LangOpts .hasFeature (Feature::SendableCompletionHandlers) &&
1642
+ importKind == ImportTypeKind::CompletionHandlerParameter;
1640
1643
bool isNonSendable = false ;
1641
1644
1642
1645
std::function<clang::QualType (clang::QualType)> skipUnrelatedSugar =
@@ -1725,7 +1728,7 @@ ImportedType ClangImporter::Implementation::importType(
1725
1728
optionality = translateNullability (*nullability, stripNonResultOptionality);
1726
1729
}
1727
1730
1728
- applyTypeAttributes (importKind, attrs, type);
1731
+ applyTypeAttributes (SwiftContext, importKind, attrs, type);
1729
1732
1730
1733
// If this is a completion handler parameter, record the function type whose
1731
1734
// parameters will act as the results of the completion handler.
@@ -2048,14 +2051,10 @@ class GetSendableType :
2048
2051
2049
2052
} // anonymous namespace
2050
2053
2051
- ImportTypeAttrs swift::getImportTypeAttrs (const clang::Decl *D, bool isParam,
2052
- bool sendableByDefault) {
2054
+ ImportTypeAttrs swift::getImportTypeAttrs (const clang::Decl *D, bool isParam) {
2053
2055
ImportTypeAttrs attrs;
2054
2056
2055
- if (sendableByDefault)
2056
- attrs |= ImportTypeAttr::DefaultsToSendable;
2057
-
2058
- bool sendableRequested = sendableByDefault;
2057
+ bool sendableRequested = false ;
2059
2058
bool sendableDisqualified = false ;
2060
2059
2061
2060
if (D->hasAttrs ()) {
@@ -2477,12 +2476,6 @@ ClangImporter::Implementation::importParameterType(
2477
2476
}
2478
2477
2479
2478
if (!swiftParamTy) {
2480
- bool sendableByDefault =
2481
- paramIsCompletionHandler &&
2482
- SwiftContext.LangOpts .hasFeature (Feature::SendableCompletionHandlers);
2483
-
2484
- auto attrs = getImportTypeAttrs (param, /* isParam=*/ true , sendableByDefault);
2485
-
2486
2479
// If this is the throws error parameter, we don't need to convert any
2487
2480
// NSError** arguments to the sugared NSErrorPointer typealias form,
2488
2481
// because all that is done with it is retrieving the canonical
0 commit comments