File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -444,6 +444,11 @@ bool SILDeclRef::isTransparent() const {
444
444
445
445
// / True if the function should have its body serialized.
446
446
IsSerialized_t SILDeclRef::isSerialized () const {
447
+ // Native-to-foreign thunks are only referenced from the Objective-C
448
+ // method table.
449
+ if (isForeign)
450
+ return IsNotSerialized;
451
+
447
452
DeclContext *dc;
448
453
if (auto closure = getAbstractClosureExpr ())
449
454
dc = closure->getLocalContext ();
Original file line number Diff line number Diff line change 6
6
// RUN: %FileCheck < %t/static_inline.sil %s
7
7
// RUN: %target-swift-frontend -parse-as-library -module-name=static_inline -O -emit-ir %t/static_inline.sil -enable-objc-interop -import-objc-header %S/Inputs/static_inline.h | %FileCheck --check-prefix=CHECK-IR %s
8
8
9
- // CHECK: sil shared [serializable] [ clang c_inline_func] @c_inline_func : $@convention(c) (Int32) -> Int32
9
+ // CHECK: sil shared [clang c_inline_func] @c_inline_func : $@convention(c) (Int32) -> Int32
10
10
11
11
// CHECK-IR-LABEL: define{{.*}} i32 @"$s13static_inline6testit1xs5Int32VAE_tF"(i32)
12
12
// CHECK-IR: = add {{.*}}, 27
Original file line number Diff line number Diff line change @@ -10,9 +10,22 @@ import Foundation
10
10
11
11
public class Horse : NSObject {
12
12
@objc public dynamic func gallop( ) { }
13
+ @objc public func someMethod( ) { }
14
+ @objc public convenience init ( saddle: ( ) ) {
15
+ self . init ( )
16
+ }
17
+ @objc public override init ( ) { }
13
18
}
14
19
15
- // Make sure we can reference dynamic thunks and curry thunks
20
+ // @objc thunks are not serialized, since they are only referenced from
21
+ // method tables.
22
+
23
+ // CHECK-LABEL: sil [thunk] [ossa] @$s24inlinable_attribute_objc5HorseC6gallopyyFTo : $@convention(objc_method) (Horse) -> ()
24
+ // CHECK-LABEL: sil [thunk] [ossa] @$s24inlinable_attribute_objc5HorseC10someMethodyyFTo : $@convention(objc_method) (Horse) -> ()
25
+ // CHECK-LABEL: sil [thunk] [ossa] @$s24inlinable_attribute_objc5HorseC6saddleACyt_tcfcTo : $@convention(objc_method) (@owned Horse) -> @owned Horse
26
+ // CHECK-LABEL: sil [thunk] [ossa] @$s24inlinable_attribute_objc5HorseCACycfcTo : $@convention(objc_method) (@owned Horse) -> @owned Horse
27
+
28
+ // However, make sure we can reference dynamic thunks and curry thunks
16
29
// from inlinable scopes
17
30
18
31
// CHECK-LABEL: sil [serialized] [ossa] @$s24inlinable_attribute_objc15talkAboutAHorse1hyAA5HorseC_tF : $@convention(thin) (@guaranteed Horse) -> () {
You can’t perform that action at this time.
0 commit comments