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) {
449
449
auto proto = type->getDecl ();
450
450
auto &clangCtx = ClangASTContext;
451
451
452
+ // Strip 'Sendable'.
453
+ auto strippedType = type->stripConcurrency (false , false );
454
+ if (strippedType.getPointer () != type)
455
+ return convert (strippedType);
456
+
452
457
if (!proto->isObjC ())
453
458
return clang::QualType ();
454
459
@@ -702,6 +707,11 @@ ClangTypeConverter::visitSILBlockStorageType(SILBlockStorageType *type) {
702
707
703
708
clang::QualType
704
709
ClangTypeConverter::visitProtocolCompositionType (ProtocolCompositionType *type) {
710
+ // Strip 'Sendable'.
711
+ auto strippedType = type->stripConcurrency (false , false );
712
+ if (strippedType.getPointer () != type)
713
+ return convert (strippedType);
714
+
705
715
// Any will be lowered to AnyObject, so we return the same result.
706
716
if (type->isAny ())
707
717
return getClangIdType (ClangASTContext);
Original file line number Diff line number Diff line change @@ -306,7 +306,9 @@ ExistentialLayout::ExistentialLayout(CanProtocolCompositionType type) {
306
306
protoDecl = parameterized->getProtocol ();
307
307
containsParameterized = true ;
308
308
}
309
- containsNonObjCProtocol |= !protoDecl->isObjC ();
309
+ containsNonObjCProtocol |=
310
+ !protoDecl->isObjC () &&
311
+ !protoDecl->isSpecificProtocol (KnownProtocolKind::Sendable);
310
312
protocols.push_back (protoDecl);
311
313
}
312
314
}
Original file line number Diff line number Diff line change
1
+ #import < Foundation/Foundation.h>
2
+
3
+ @interface A : NSObject
4
+ - (id <NSObject >)foo NS_SWIFT_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