@@ -6641,7 +6641,7 @@ static bool conformsToProtocolInOriginalModule(NominalTypeDecl *nominal,
66416641  for  (auto  attr : nominal->getAttrs ().getAttributes <SynthesizedProtocolAttr>()) {
66426642    auto  *otherProto = attr->getProtocol ();
66436643    if  (otherProto == proto || otherProto->inheritsFrom (proto))
6644-       return  true ;
6644+       return  !attr-> isSuppressed () ;
66456645  }
66466646
66476647  //  Only consider extensions from the original module...or from an overlay
@@ -8949,6 +8949,7 @@ ClangImporter::Implementation::importSwiftAttrAttributes(Decl *MappedDecl) {
89498949  std::optional<const  clang::SwiftAttrAttr *> seenMainActorAttr;
89508950  const  clang::SwiftAttrAttr *seenMutabilityAttr = nullptr ;
89518951  llvm::SmallSet<ProtocolDecl *, 4 > conformancesSeen;
8952+   const  clang::SwiftAttrAttr *seenSendableSuppressionAttr = nullptr ;
89528953
89538954  auto  importAttrsFromDecl = [&](const  clang::NamedDecl *ClangDecl) {
89548955    // 
@@ -9041,6 +9042,18 @@ ClangImporter::Implementation::importSwiftAttrAttributes(Decl *MappedDecl) {
90419042        nominal->registerProtocolConformance (conformance, /* synthesized=*/ true );
90429043      }
90439044
9045+       if  (swiftAttr->getAttribute () == " ~Sendable" 
9046+         auto  *nominal = dyn_cast<NominalTypeDecl>(MappedDecl);
9047+         if  (!nominal)
9048+           continue ;
9049+ 
9050+         seenSendableSuppressionAttr = swiftAttr;
9051+         addSynthesizedProtocolAttrs (nominal, {KnownProtocolKind::Sendable},
9052+                                     /* isUnchecked=*/ false ,
9053+                                     /* isSuppressed=*/ true );
9054+         continue ;
9055+       }
9056+ 
90449057      if  (swiftAttr->getAttribute () == " sending" 
90459058        //  Swallow this if the feature is not enabled.
90469059        if  (!SwiftContext.LangOpts .hasFeature (Feature::SendingArgsAndResults))
@@ -9108,10 +9121,11 @@ ClangImporter::Implementation::importSwiftAttrAttributes(Decl *MappedDecl) {
91089121      MappedDecl->getAttrs ().removeAttribute (attr);
91099122
91109123  //  Some types have an implicit '@Sendable' attribute.
9111-   if  (ClangDecl->hasAttr <clang::SwiftNewTypeAttr>() ||
9112-       ClangDecl->hasAttr <clang::EnumExtensibilityAttr>() ||
9113-       ClangDecl->hasAttr <clang::FlagEnumAttr>() ||
9114-       ClangDecl->hasAttr <clang::NSErrorDomainAttr>())
9124+   if  ((ClangDecl->hasAttr <clang::SwiftNewTypeAttr>() ||
9125+        ClangDecl->hasAttr <clang::EnumExtensibilityAttr>() ||
9126+        ClangDecl->hasAttr <clang::FlagEnumAttr>() ||
9127+        ClangDecl->hasAttr <clang::NSErrorDomainAttr>()) &&
9128+       !seenSendableSuppressionAttr)
91159129    MappedDecl->addAttribute (new  (SwiftContext)
91169130                                 SendableAttr (/* isImplicit=*/ true ));
91179131
0 commit comments