File tree Expand file tree Collapse file tree 4 files changed +27
-1
lines changed Expand file tree Collapse file tree 4 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -449,6 +449,11 @@ clang::QualType ClangTypeConverter::visitProtocolType(ProtocolType *type) {
449449 auto proto = type->getDecl ();
450450 auto &clangCtx = ClangASTContext;
451451
452+ // Strip 'Sendable'.
453+ auto strippedType = type->stripConcurrency (false , false );
454+ if (strippedType.getPointer () != type)
455+ return convert (strippedType);
456+
452457 if (!proto->isObjC ())
453458 return clang::QualType ();
454459
@@ -702,6 +707,11 @@ ClangTypeConverter::visitSILBlockStorageType(SILBlockStorageType *type) {
702707
703708clang::QualType
704709ClangTypeConverter::visitProtocolCompositionType (ProtocolCompositionType *type) {
710+ // Strip 'Sendable'.
711+ auto strippedType = type->stripConcurrency (false , false );
712+ if (strippedType.getPointer () != type)
713+ return convert (strippedType);
714+
705715 // Any will be lowered to AnyObject, so we return the same result.
706716 if (type->isAny ())
707717 return getClangIdType (ClangASTContext);
Original file line number Diff line number Diff line change @@ -306,7 +306,9 @@ ExistentialLayout::ExistentialLayout(CanProtocolCompositionType type) {
306306 protoDecl = parameterized->getProtocol ();
307307 containsParameterized = true ;
308308 }
309- containsNonObjCProtocol |= !protoDecl->isObjC ();
309+ containsNonObjCProtocol |=
310+ !protoDecl->isObjC () &&
311+ !protoDecl->isSpecificProtocol (KnownProtocolKind::Sendable);
310312 protocols.push_back (protoDecl);
311313 }
312314}
Original file line number Diff line number Diff line change 1+ #import < Foundation/Foundation.h>
2+
3+ @interface A : NSObject
4+ - (id <NSObject >)foo __attribute__((swift_attr(" @Sendable" )));
5+ @end
Original file line number Diff line number Diff line change 1+ // RUN: %target-swift-frontend -emit-ir %s -swift-version 5 -import-objc-header %S/Inputs/objc_protocol_sendable.h | %IRGenFileCheck %s
2+
3+ // REQUIRES: objc_interop
4+ // REQUIRES: concurrency
5+
6+ // CHECK: define{{.*}}s22objc_protocol_sendable4test1aySo1AC_tF
7+ public func test( a: A ) {
8+ a. foo ( )
9+ }
You can’t perform that action at this time.
0 commit comments