Skip to content

Commit 5fbede2

Browse files
authored
Merge pull request #59313 from slavapestov/reapply-objc-thunk-linkage
Reapply "SIL: @objc thunks should have private SIL linkage"
2 parents dadbfa2 + f40d4e8 commit 5fbede2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+299
-284
lines changed

lib/IRGen/GenObjC.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,6 @@ static llvm::Constant *findSwiftAsObjCThunk(IRGenModule &IGM, SILDeclRef ref,
944944
SILFn = IGM.getSILModule().lookUpFunction(ref);
945945
assert(SILFn && "no IR function for swift-as-objc thunk");
946946
auto fn = IGM.getAddrOfSILFunction(SILFn, NotForDefinition);
947-
ApplyIRLinkage(IRLinkage::Internal).to(fn);
948947
// Don't add the unnamed_addr attribute: in some places Foundation is
949948
// comparing ObjC method pointers. Therefore LLVM's function merging pass must
950949
// not create aliases for identical functions, but create thunks.

lib/SIL/IR/SILDeclRef.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,20 @@ SILLinkage SILDeclRef::getLinkage(ForDefinition_t forDefinition) const {
396396
if (fn->hasForcedStaticDispatch()) {
397397
limit = Limit::OnDemand;
398398
}
399+
}
399400

401+
if (auto fn = dyn_cast<AbstractFunctionDecl>(d)) {
400402
// Native-to-foreign thunks for top-level decls are created on-demand,
401403
// unless they are marked @_cdecl, in which case they expose a dedicated
402404
// entry-point with the visibility of the function.
405+
//
406+
// Native-to-foreign thunks for methods are always just private, since
407+
// they're anchored by Objective-C metadata.
403408
if (isNativeToForeignThunk() && !fn->getAttrs().hasAttribute<CDeclAttr>()) {
404409
if (fn->getDeclContext()->isModuleScopeContext())
405410
limit = Limit::OnDemand;
411+
else
412+
return SILLinkage::Private;
406413
}
407414
}
408415

test/ClangImporter/optional.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class A {
1212
@objc func foo() -> String? {
1313
return ""
1414
}
15-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s8optional1AC3fooSSSgyFTo : $@convention(objc_method) (A) -> @autoreleased Optional<NSString>
15+
// CHECK-LABEL: sil private [thunk] [ossa] @$s8optional1AC3fooSSSgyFTo : $@convention(objc_method) (A) -> @autoreleased Optional<NSString>
1616
// CHECK: bb0([[SELF:%.*]] : @unowned $A):
1717
// CHECK: [[SELF_COPY:%.*]] = copy_value [[SELF]]
1818
// CHECK: [[BORROWED_SELF_COPY:%.*]] = begin_borrow [[SELF_COPY]]
@@ -41,7 +41,7 @@ class A {
4141
// CHECK-NEXT: return [[T0]]
4242

4343
@objc func bar(x x : String?) {}
44-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s8optional1AC3bar1xySSSg_tFTo : $@convention(objc_method) (Optional<NSString>, A) -> ()
44+
// CHECK-LABEL: sil private [thunk] [ossa] @$s8optional1AC3bar1xySSSg_tFTo : $@convention(objc_method) (Optional<NSString>, A) -> ()
4545
// CHECK: bb0([[ARG:%.*]] : @unowned $Optional<NSString>, [[SELF:%.*]] : @unowned $A):
4646
// CHECK: [[ARG_COPY:%.*]] = copy_value [[ARG]]
4747
// CHECK: [[SELF_COPY:%.*]] = copy_value [[SELF]]

test/IRGen/abitypes.swift

Lines changed: 51 additions & 51 deletions
Large diffs are not rendered by default.

test/IRGen/newtype.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public func anchor() -> Bool {
118118
}
119119

120120
class ObjCTest {
121-
// CHECK-LABEL: define hidden %0* @"$s7newtype8ObjCTestC19optionalPassThroughySo14SNTErrorDomainaSgAGFTo"
121+
// CHECK-LABEL: define internal %0* @"$s7newtype8ObjCTestC19optionalPassThroughySo14SNTErrorDomainaSgAGFTo"
122122
// CHECK: [[CASTED:%.+]] = ptrtoint %0* %2 to [[INT]]
123123
// CHECK: [[RESULT:%.+]] = call swiftcc [[INT]] @"$s7newtype8ObjCTestC19optionalPassThroughySo14SNTErrorDomainaSgAGF"([[INT]] [[CASTED]], %T7newtype8ObjCTestC* swiftself {{%.+}})
124124
// CHECK: [[CAST_RESULT:%.+]] = inttoptr [[INT]] [[RESULT]] to i8*
@@ -128,7 +128,7 @@ class ObjCTest {
128128
// CHECK: ret %0* [[OPAQUE_RESULT]]
129129
// CHECK: {{^}$}}
130130

131-
// OPT-LABEL: define hidden %0* @"$s7newtype8ObjCTestC19optionalPassThroughySo14SNTErrorDomainaSgAGFTo"
131+
// OPT-LABEL: define internal %0* @"$s7newtype8ObjCTestC19optionalPassThroughySo14SNTErrorDomainaSgAGFTo"
132132
// OPT: [[ARG_CASTED2:%.*]] = bitcast %0* %2 to i8*
133133
// OPT: [[RES:%.*]] = tail call i8* @llvm.objc.retainAutoreleaseReturnValue(i8* [[ARG_CASTED2]])
134134
// OPT: [[CAST_FOR_RETURN:%.*]] = bitcast i8* [[RES]] to %0*
@@ -138,12 +138,12 @@ class ObjCTest {
138138
return ed
139139
}
140140

141-
// CHECK-LABEL: define hidden i32 @"$s7newtype8ObjCTestC18integerPassThroughySo5MyIntaAFFTo"
141+
// CHECK-LABEL: define internal i32 @"$s7newtype8ObjCTestC18integerPassThroughySo5MyIntaAFFTo"
142142
// CHECK: [[RESULT:%.+]] = call swiftcc i32 @"$s7newtype8ObjCTestC18integerPassThroughySo5MyIntaAFF"(i32 %2, %T7newtype8ObjCTestC* swiftself {{%.+}})
143143
// CHECK: ret i32 [[RESULT]]
144144
// CHECK: {{^}$}}
145145

146-
// OPT-LABEL: define hidden i32 @"$s7newtype8ObjCTestC18integerPassThroughySo5MyIntaAFFTo"
146+
// OPT-LABEL: define internal i32 @"$s7newtype8ObjCTestC18integerPassThroughySo5MyIntaAFFTo"
147147
// OPT: ret i32 %2
148148
// OPT: {{^}$}}
149149
@objc func integerPassThrough(_ num: MyInt) -> MyInt {

test/IRGen/objc_dealloc.sil

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ bb0(%0 : @owned $SwiftGizmo):
4848
return %5 : $Builtin.NativeObject // id: %6
4949
}
5050

51-
sil [ossa] @$s12objc_dealloc10SwiftGizmoC1xAA1XCfgTo : $@convention(objc_method) (SwiftGizmo) -> @autoreleased X {
51+
sil private [ossa] @$s12objc_dealloc10SwiftGizmoC1xAA1XCfgTo : $@convention(objc_method) (SwiftGizmo) -> @autoreleased X {
5252
bb0(%0 : @unowned $SwiftGizmo):
5353
%1 = unchecked_ownership_conversion %0 : $SwiftGizmo, @unowned to @guaranteed
5454
%2 = ref_element_addr %1 : $SwiftGizmo, #SwiftGizmo.x // user: %2
@@ -57,7 +57,7 @@ bb0(%0 : @unowned $SwiftGizmo):
5757
return %3 : $X // id: %4
5858
}
5959

60-
sil [ossa] @$s12objc_dealloc10SwiftGizmoC1xAA1XCfsTo : $@convention(objc_method) (X, SwiftGizmo) -> () {
60+
sil private [ossa] @$s12objc_dealloc10SwiftGizmoC1xAA1XCfsTo : $@convention(objc_method) (X, SwiftGizmo) -> () {
6161
bb0(%0 : @unowned $X, %1 : @unowned $SwiftGizmo):
6262
%2 = copy_value %0 : $X
6363
%3 = copy_value %1 : $SwiftGizmo
@@ -71,7 +71,7 @@ bb0(%0 : @unowned $X, %1 : @unowned $SwiftGizmo):
7171
}
7272

7373
// CHECK: define internal void @"$s12objc_dealloc10SwiftGizmoCfDTo"([[OPAQUE:%.*]]* %0, i8* %1) {{[#0-9]*}} {
74-
sil [ossa] @$s12objc_dealloc10SwiftGizmoCfDTo : $@convention(objc_method) (SwiftGizmo) -> () {
74+
sil private [ossa] @$s12objc_dealloc10SwiftGizmoCfDTo : $@convention(objc_method) (SwiftGizmo) -> () {
7575
bb0(%0 : @unowned $SwiftGizmo):
7676
// CHECK-NEXT: entry
7777
// CHECK-NEXT: [[OBJC_SUPER:%[a-zA-Z0-9_]+]] = alloca %objc_super, align 8

test/IRGen/objc_deprecated_objc_thunks.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ObjCSubclass : NSObject {
1111
func foo() { }
1212
}
1313

14-
// CHECK-LABEL: define hidden void @"$s016objc_deprecated_A7_thunks12ObjCSubclassC3fooyyFTo"(%0* %0, i8* %1)
14+
// CHECK-LABEL: define internal void @"$s016objc_deprecated_A7_thunks12ObjCSubclassC3fooyyFTo"(%0* %0, i8* %1)
1515
// CHECK: entry:
1616
// CHECK: [[SELF:%[0-9]+]] = bitcast %0* %0 to %objc_object*
1717
// CHECK-NEXT: call void @swift_objc_swift3ImplicitObjCEntrypoint(%objc_object* [[SELF]], i8* %1, i8* getelementptr inbounds ({{.*}}[[FILENAME_STR]]{{.*}}), i64 [[FILENAME_LENGTH:[0-9]+]], i64 11, i64 3, i8* {{.*}})
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %target-swift-emit-silgen(mock-sdk: -sdk %S/Inputs) %s | %FileCheck %s
2+
// REQUIRES: objc_interop
3+
4+
import Foundation
5+
6+
@objc public class Horse : NSObject {
7+
@_alwaysEmitIntoClient @objc public dynamic var height: Int { 14 }
8+
}
9+
10+
// CHECK-LABEL: sil private [thunk] [ossa] @$s28always_emit_into_client_objc5HorseC6heightSivgTo : $@convention(objc_method) (Horse) -> Int {
11+
// CHECK-LABEL: sil non_abi [serialized] [ossa] @$s28always_emit_into_client_objc5HorseC6heightSivg : $@convention(method) (@guaranteed Horse) -> Int {

test/SILGen/cf.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@ extension CCImpedance: Impedance {}
6363
// CHECK-LABEL: sil shared [transparent] [serialized] [ossa] @$sSo11CCImpedanceV4imagSdvg
6464

6565
class MyMagnetism : CCMagnetismModel {
66-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s2cf11MyMagnetismC15getRefrigerator{{[_0-9a-zA-Z]*}}FTo : $@convention(objc_method) (MyMagnetism) -> @autoreleased CCRefrigerator
66+
// CHECK-LABEL: sil private [thunk] [ossa] @$s2cf11MyMagnetismC15getRefrigerator{{[_0-9a-zA-Z]*}}FTo : $@convention(objc_method) (MyMagnetism) -> @autoreleased CCRefrigerator
6767
override func getRefrigerator() -> CCRefrigerator {
6868
return super.getRefrigerator()
6969
}
7070

71-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s2cf11MyMagnetismC16takeRefrigerator{{[_0-9a-zA-Z]*}}FTo : $@convention(objc_method) (MyMagnetism) -> @owned CCRefrigerator
71+
// CHECK-LABEL: sil private [thunk] [ossa] @$s2cf11MyMagnetismC16takeRefrigerator{{[_0-9a-zA-Z]*}}FTo : $@convention(objc_method) (MyMagnetism) -> @owned CCRefrigerator
7272
override func takeRefrigerator() -> CCRefrigerator {
7373
return super.takeRefrigerator()
7474
}
7575

76-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s2cf11MyMagnetismC18borrowRefrigerator{{[_0-9a-zA-Z]*}}FTo : $@convention(objc_method) (MyMagnetism) -> @autoreleased CCRefrigerator
76+
// CHECK-LABEL: sil private [thunk] [ossa] @$s2cf11MyMagnetismC18borrowRefrigerator{{[_0-9a-zA-Z]*}}FTo : $@convention(objc_method) (MyMagnetism) -> @autoreleased CCRefrigerator
7777
override func borrowRefrigerator() -> CCRefrigerator {
7878
return super.borrowRefrigerator()
7979
}

test/SILGen/convenience_init_peer_delegation.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class ObjCBase {
8787
// CHECK-LABEL: sil hidden [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC11objcToSwiftACyt_tcfc
8888
// CHECK: class_method {{%.+}} : $@thick ObjCBase.Type, #ObjCBase.init!allocator
8989
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC11objcToSwiftACyt_tcfc'
90-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC11objcToSwiftACyt_tcfcTo
90+
// CHECK-LABEL: sil private [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC11objcToSwiftACyt_tcfcTo
9191
// CHECK: function_ref @$s32convenience_init_peer_delegation8ObjCBaseC11objcToSwiftACyt_tcfc :
9292
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC11objcToSwiftACyt_tcfcTo'
9393
@objc convenience init(objcToSwift: ()) {
@@ -107,7 +107,7 @@ class ObjCBase {
107107
// CHECK-LABEL: sil hidden [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE1CACyt_tcfc
108108
// CHECK: objc_method {{%.+}} : $ObjCBase, #ObjCBase.init!initializer.foreign
109109
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC06objcToE1CACyt_tcfc'
110-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE1CACyt_tcfcTo
110+
// CHECK-LABEL: sil private [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE1CACyt_tcfcTo
111111
// CHECK: function_ref @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE1CACyt_tcfc :
112112
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC06objcToE1CACyt_tcfcTo'
113113
@objc convenience init(objcToObjC: ()) {
@@ -120,7 +120,7 @@ class ObjCBase {
120120
// CHECK-LABEL: sil hidden [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC22objcToSwiftConvenienceACyt_tcfc
121121
// CHECK: function_ref @$s32convenience_init_peer_delegation8ObjCBaseC07swiftToE1CACyt_tcfC :
122122
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC22objcToSwiftConvenienceACyt_tcfc'
123-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC22objcToSwiftConvenienceACyt_tcfcTo
123+
// CHECK-LABEL: sil private [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC22objcToSwiftConvenienceACyt_tcfcTo
124124
// CHECK: function_ref @$s32convenience_init_peer_delegation8ObjCBaseC22objcToSwiftConvenienceACyt_tcfc :
125125
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC22objcToSwiftConvenienceACyt_tcfcTo'
126126
@objc convenience init(objcToSwiftConvenience: ()) {
@@ -140,7 +140,7 @@ class ObjCBase {
140140
// CHECK-LABEL: sil hidden [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE12CConvenienceACyt_tcfc
141141
// CHECK: objc_method {{%.+}} : $ObjCBase, #ObjCBase.init!initializer.foreign
142142
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC06objcToE12CConvenienceACyt_tcfc'
143-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE12CConvenienceACyt_tcfcTo
143+
// CHECK-LABEL: sil private [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE12CConvenienceACyt_tcfcTo
144144
// CHECK: function_ref @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE12CConvenienceACyt_tcfc :
145145
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC06objcToE12CConvenienceACyt_tcfcTo'
146146
@objc convenience init(objcToObjCConvenience: ()) {

test/SILGen/convenience_init_peer_delegation_import.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ extension ImportedClass {
4040
// CHECK-LABEL: sil hidden [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE16objcToDesignatedAByt_tcfc
4141
// CHECK: objc_method {{%.+}} : $ImportedClass, #ImportedClass.init!initializer.foreign
4242
// CHECK: end sil function '$sSo13ImportedClassC39convenience_init_peer_delegation_importE16objcToDesignatedAByt_tcfc'
43-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE16objcToDesignatedAByt_tcfcTo
43+
// CHECK-LABEL: sil private [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE16objcToDesignatedAByt_tcfcTo
4444
// CHECK: function_ref @$sSo13ImportedClassC39convenience_init_peer_delegation_importE16objcToDesignatedAByt_tcfc :
4545
@objc convenience init(objcToDesignated: ()) {
4646
self.init()
@@ -55,7 +55,7 @@ extension ImportedClass {
5555
// CHECK-LABEL: sil hidden [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE17objcToConvenienceAByt_tcfc
5656
// CHECK: objc_method {{%.+}} : $ImportedClass, #ImportedClass.init!initializer.foreign
5757
// CHECK: end sil function '$sSo13ImportedClassC39convenience_init_peer_delegation_importE17objcToConvenienceAByt_tcfc'
58-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE17objcToConvenienceAByt_tcfcTo
58+
// CHECK-LABEL: sil private [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE17objcToConvenienceAByt_tcfcTo
5959
// CHECK: function_ref @$sSo13ImportedClassC39convenience_init_peer_delegation_importE17objcToConvenienceAByt_tcfc :
6060
// CHECK: end sil function '$sSo13ImportedClassC39convenience_init_peer_delegation_importE17objcToConvenienceAByt_tcfcTo'
6161
@objc convenience init(objcToConvenience: ()) {
@@ -71,7 +71,7 @@ extension ImportedClass {
7171
// CHECK-LABEL: sil hidden [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE24objcToConvenienceFactoryAByt_tcfc
7272
// CHECK: objc_method {{%.+}} : $@objc_metatype ImportedClass.Type, #ImportedClass.init!allocator.foreign
7373
// CHECK: end sil function '$sSo13ImportedClassC39convenience_init_peer_delegation_importE24objcToConvenienceFactoryAByt_tcfc'
74-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE24objcToConvenienceFactoryAByt_tcfcTo
74+
// CHECK-LABEL: sil private [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE24objcToConvenienceFactoryAByt_tcfcTo
7575
// CHECK: function_ref @$sSo13ImportedClassC39convenience_init_peer_delegation_importE24objcToConvenienceFactoryAByt_tcfc :
7676
// CHECK: end sil function '$sSo13ImportedClassC39convenience_init_peer_delegation_importE24objcToConvenienceFactoryAByt_tcfcTo'
7777
@objc convenience init(objcToConvenienceFactory: ()) {
@@ -87,7 +87,7 @@ extension ImportedClass {
8787
// CHECK-LABEL: sil hidden [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE19objcToNormalFactoryAByt_tcfc
8888
// CHECK: objc_method {{%.+}} : $@objc_metatype ImportedClass.Type, #ImportedClass.init!allocator.foreign
8989
// CHECK: end sil function '$sSo13ImportedClassC39convenience_init_peer_delegation_importE19objcToNormalFactoryAByt_tcfc'
90-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE19objcToNormalFactoryAByt_tcfcTo
90+
// CHECK-LABEL: sil private [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE19objcToNormalFactoryAByt_tcfcTo
9191
// CHECK: function_ref @$sSo13ImportedClassC39convenience_init_peer_delegation_importE19objcToNormalFactoryAByt_tcfc :
9292
// CHECK: end sil function '$sSo13ImportedClassC39convenience_init_peer_delegation_importE19objcToNormalFactoryAByt_tcfcTo'
9393
@objc convenience init(objcToNormalFactory: ()) {

test/SILGen/dynamic.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,25 @@ protocol Proto {
7272
// CHECK-LABEL: sil hidden [exact_self_class] [ossa] @$s7dynamic3FooC{{.*}}tcfC
7373
// CHECK: function_ref @$s7dynamic3FooC{{.*}}tcfc
7474

75-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3{{[_0-9a-zA-Z]*}}fcTo
76-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3FooC10objcMethod{{[_0-9a-zA-Z]*}}FTo
77-
// CHECK-LABEL: sil hidden [transparent] [thunk] [ossa] @$s7dynamic3FooC8objcPropSivgTo
78-
// CHECK-LABEL: sil hidden [transparent] [thunk] [ossa] @$s7dynamic3FooC8objcPropSivsTo
79-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3FooC4objcSiyXl_tcigTo
80-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3FooC4objcSiyXl_tcisTo
75+
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3{{[_0-9a-zA-Z]*}}fcTo
76+
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3FooC10objcMethod{{[_0-9a-zA-Z]*}}FTo
77+
// CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s7dynamic3FooC8objcPropSivgTo
78+
// CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s7dynamic3FooC8objcPropSivsTo
79+
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3FooC4objcSiyXl_tcigTo
80+
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3FooC4objcSiyXl_tcisTo
8181

8282
// TODO: dynamic initializing ctor must be objc dispatched
8383
// CHECK-LABEL: sil hidden [ossa] @$s7dynamic3{{[_0-9a-zA-Z]*}}fC
8484
// CHECK: function_ref @$s7dynamic3{{[_0-9a-zA-Z]*}}fcTD
8585
// CHECK-LABEL: sil shared [transparent] [serialized] [thunk] [ossa] @$s7dynamic3{{[_0-9a-zA-Z]*}}fcTD
8686
// CHECK: objc_method {{%.*}} : $Foo, #Foo.init!initializer.foreign :
8787

88-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3{{[_0-9a-zA-Z]*}}fcTo
89-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3FooC0A6Method{{[_0-9a-zA-Z]*}}FTo
90-
// CHECK-LABEL: sil hidden [transparent] [thunk] [ossa] @$s7dynamic3FooC0A4PropSivgTo
91-
// CHECK-LABEL: sil hidden [transparent] [thunk] [ossa] @$s7dynamic3FooC0A4PropSivsTo
92-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3FooCAAS2i_tcigTo
93-
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3FooCAAS2i_tcisTo
88+
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3{{[_0-9a-zA-Z]*}}fcTo
89+
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3FooC0A6Method{{[_0-9a-zA-Z]*}}FTo
90+
// CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s7dynamic3FooC0A4PropSivgTo
91+
// CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s7dynamic3FooC0A4PropSivsTo
92+
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3FooCAAS2i_tcigTo
93+
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3FooCAAS2i_tcisTo
9494

9595
// Protocol witnesses use best appropriate dispatch
9696

test/SILGen/dynamic_accessors.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@
55

66
public class MyObjCClass {
77
@objc public dynamic var a: Int {
8-
// CHECK-LABEL: sil [thunk] [ossa] @$s17dynamic_accessors11MyObjCClassC1aSivgTo : $@convention(objc_method) (MyObjCClass) -> Int {
8+
// CHECK-LABEL: sil private [thunk] [ossa] @$s17dynamic_accessors11MyObjCClassC1aSivgTo : $@convention(objc_method) (MyObjCClass) -> Int {
99
// CHECK: function_ref @$s17dynamic_accessors11MyObjCClassC1aSivg
1010
// CHECK: }
1111
get { return 4 }
1212

13-
// CHECK-LABEL: sil [thunk] [ossa] @$s17dynamic_accessors11MyObjCClassC1aSivsTo : $@convention(objc_method) (Int, MyObjCClass) -> () {
13+
// CHECK-LABEL: sil private [thunk] [ossa] @$s17dynamic_accessors11MyObjCClassC1aSivsTo : $@convention(objc_method) (Int, MyObjCClass) -> () {
1414
// CHECK: function_ref @$s17dynamic_accessors11MyObjCClassC1aSivs
1515
// CHECK: }
1616
set {}
1717
}
1818

1919
@objc public dynamic subscript(x: Int) -> Int {
20-
// CHECK-LABEL: sil [thunk] [ossa] @$s17dynamic_accessors11MyObjCClassCyS2icigTo : $@convention(objc_method) (Int, MyObjCClass) -> Int {
20+
// CHECK-LABEL: sil private [thunk] [ossa] @$s17dynamic_accessors11MyObjCClassCyS2icigTo : $@convention(objc_method) (Int, MyObjCClass) -> Int {
2121
// CHECK: function_ref @$s17dynamic_accessors11MyObjCClassCyS2icig
2222
// CHECK: }
2323
get { return x }
2424

25-
// CHECK-LABEL: sil [thunk] [ossa] @$s17dynamic_accessors11MyObjCClassCyS2icisTo : $@convention(objc_method) (Int, Int, MyObjCClass) -> () {
25+
// CHECK-LABEL: sil private [thunk] [ossa] @$s17dynamic_accessors11MyObjCClassCyS2icisTo : $@convention(objc_method) (Int, Int, MyObjCClass) -> () {
2626
// CHECK: function_ref @$s17dynamic_accessors11MyObjCClassCyS2icis
2727
// CHECK: }
2828
set {}

0 commit comments

Comments
 (0)