Skip to content

Reapply "SIL: @objc thunks should have private SIL linkage" #59313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/IRGen/GenObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,6 @@ static llvm::Constant *findSwiftAsObjCThunk(IRGenModule &IGM, SILDeclRef ref,
SILFn = IGM.getSILModule().lookUpFunction(ref);
assert(SILFn && "no IR function for swift-as-objc thunk");
auto fn = IGM.getAddrOfSILFunction(SILFn, NotForDefinition);
ApplyIRLinkage(IRLinkage::Internal).to(fn);
// Don't add the unnamed_addr attribute: in some places Foundation is
// comparing ObjC method pointers. Therefore LLVM's function merging pass must
// not create aliases for identical functions, but create thunks.
Expand Down
7 changes: 7 additions & 0 deletions lib/SIL/IR/SILDeclRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,20 @@ SILLinkage SILDeclRef::getLinkage(ForDefinition_t forDefinition) const {
if (fn->hasForcedStaticDispatch()) {
limit = Limit::OnDemand;
}
}

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

Expand Down
4 changes: 2 additions & 2 deletions test/ClangImporter/optional.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class A {
@objc func foo() -> String? {
return ""
}
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s8optional1AC3fooSSSgyFTo : $@convention(objc_method) (A) -> @autoreleased Optional<NSString>
// CHECK-LABEL: sil private [thunk] [ossa] @$s8optional1AC3fooSSSgyFTo : $@convention(objc_method) (A) -> @autoreleased Optional<NSString>
// CHECK: bb0([[SELF:%.*]] : @unowned $A):
// CHECK: [[SELF_COPY:%.*]] = copy_value [[SELF]]
// CHECK: [[BORROWED_SELF_COPY:%.*]] = begin_borrow [[SELF_COPY]]
Expand Down Expand Up @@ -41,7 +41,7 @@ class A {
// CHECK-NEXT: return [[T0]]

@objc func bar(x x : String?) {}
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s8optional1AC3bar1xySSSg_tFTo : $@convention(objc_method) (Optional<NSString>, A) -> ()
// CHECK-LABEL: sil private [thunk] [ossa] @$s8optional1AC3bar1xySSSg_tFTo : $@convention(objc_method) (Optional<NSString>, A) -> ()
// CHECK: bb0([[ARG:%.*]] : @unowned $Optional<NSString>, [[SELF:%.*]] : @unowned $A):
// CHECK: [[ARG_COPY:%.*]] = copy_value [[ARG]]
// CHECK: [[SELF_COPY:%.*]] = copy_value [[SELF]]
Expand Down
102 changes: 51 additions & 51 deletions test/IRGen/abitypes.swift

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions test/IRGen/newtype.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public func anchor() -> Bool {
}

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

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

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

// OPT-LABEL: define hidden i32 @"$s7newtype8ObjCTestC18integerPassThroughySo5MyIntaAFFTo"
// OPT-LABEL: define internal i32 @"$s7newtype8ObjCTestC18integerPassThroughySo5MyIntaAFFTo"
// OPT: ret i32 %2
// OPT: {{^}$}}
@objc func integerPassThrough(_ num: MyInt) -> MyInt {
Expand Down
6 changes: 3 additions & 3 deletions test/IRGen/objc_dealloc.sil
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bb0(%0 : @owned $SwiftGizmo):
return %5 : $Builtin.NativeObject // id: %6
}

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

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

// CHECK: define internal void @"$s12objc_dealloc10SwiftGizmoCfDTo"([[OPAQUE:%.*]]* %0, i8* %1) {{[#0-9]*}} {
sil [ossa] @$s12objc_dealloc10SwiftGizmoCfDTo : $@convention(objc_method) (SwiftGizmo) -> () {
sil private [ossa] @$s12objc_dealloc10SwiftGizmoCfDTo : $@convention(objc_method) (SwiftGizmo) -> () {
bb0(%0 : @unowned $SwiftGizmo):
// CHECK-NEXT: entry
// CHECK-NEXT: [[OBJC_SUPER:%[a-zA-Z0-9_]+]] = alloca %objc_super, align 8
Expand Down
2 changes: 1 addition & 1 deletion test/IRGen/objc_deprecated_objc_thunks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ObjCSubclass : NSObject {
func foo() { }
}

// CHECK-LABEL: define hidden void @"$s016objc_deprecated_A7_thunks12ObjCSubclassC3fooyyFTo"(%0* %0, i8* %1)
// CHECK-LABEL: define internal void @"$s016objc_deprecated_A7_thunks12ObjCSubclassC3fooyyFTo"(%0* %0, i8* %1)
// CHECK: entry:
// CHECK: [[SELF:%[0-9]+]] = bitcast %0* %0 to %objc_object*
// 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* {{.*}})
11 changes: 11 additions & 0 deletions test/SILGen/always_emit_into_client_objc.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: %target-swift-emit-silgen(mock-sdk: -sdk %S/Inputs) %s | %FileCheck %s
// REQUIRES: objc_interop

import Foundation

@objc public class Horse : NSObject {
@_alwaysEmitIntoClient @objc public dynamic var height: Int { 14 }
}

// CHECK-LABEL: sil private [thunk] [ossa] @$s28always_emit_into_client_objc5HorseC6heightSivgTo : $@convention(objc_method) (Horse) -> Int {
// CHECK-LABEL: sil non_abi [serialized] [ossa] @$s28always_emit_into_client_objc5HorseC6heightSivg : $@convention(method) (@guaranteed Horse) -> Int {
6 changes: 3 additions & 3 deletions test/SILGen/cf.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ extension CCImpedance: Impedance {}
// CHECK-LABEL: sil shared [transparent] [serialized] [ossa] @$sSo11CCImpedanceV4imagSdvg

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

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

// CHECK-LABEL: sil hidden [thunk] [ossa] @$s2cf11MyMagnetismC18borrowRefrigerator{{[_0-9a-zA-Z]*}}FTo : $@convention(objc_method) (MyMagnetism) -> @autoreleased CCRefrigerator
// CHECK-LABEL: sil private [thunk] [ossa] @$s2cf11MyMagnetismC18borrowRefrigerator{{[_0-9a-zA-Z]*}}FTo : $@convention(objc_method) (MyMagnetism) -> @autoreleased CCRefrigerator
override func borrowRefrigerator() -> CCRefrigerator {
return super.borrowRefrigerator()
}
Expand Down
8 changes: 4 additions & 4 deletions test/SILGen/convenience_init_peer_delegation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class ObjCBase {
// CHECK-LABEL: sil hidden [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC11objcToSwiftACyt_tcfc
// CHECK: class_method {{%.+}} : $@thick ObjCBase.Type, #ObjCBase.init!allocator
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC11objcToSwiftACyt_tcfc'
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC11objcToSwiftACyt_tcfcTo
// CHECK-LABEL: sil private [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC11objcToSwiftACyt_tcfcTo
// CHECK: function_ref @$s32convenience_init_peer_delegation8ObjCBaseC11objcToSwiftACyt_tcfc :
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC11objcToSwiftACyt_tcfcTo'
@objc convenience init(objcToSwift: ()) {
Expand All @@ -107,7 +107,7 @@ class ObjCBase {
// CHECK-LABEL: sil hidden [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE1CACyt_tcfc
// CHECK: objc_method {{%.+}} : $ObjCBase, #ObjCBase.init!initializer.foreign
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC06objcToE1CACyt_tcfc'
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE1CACyt_tcfcTo
// CHECK-LABEL: sil private [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE1CACyt_tcfcTo
// CHECK: function_ref @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE1CACyt_tcfc :
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC06objcToE1CACyt_tcfcTo'
@objc convenience init(objcToObjC: ()) {
Expand All @@ -120,7 +120,7 @@ class ObjCBase {
// CHECK-LABEL: sil hidden [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC22objcToSwiftConvenienceACyt_tcfc
// CHECK: function_ref @$s32convenience_init_peer_delegation8ObjCBaseC07swiftToE1CACyt_tcfC :
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC22objcToSwiftConvenienceACyt_tcfc'
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC22objcToSwiftConvenienceACyt_tcfcTo
// CHECK-LABEL: sil private [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC22objcToSwiftConvenienceACyt_tcfcTo
// CHECK: function_ref @$s32convenience_init_peer_delegation8ObjCBaseC22objcToSwiftConvenienceACyt_tcfc :
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC22objcToSwiftConvenienceACyt_tcfcTo'
@objc convenience init(objcToSwiftConvenience: ()) {
Expand All @@ -140,7 +140,7 @@ class ObjCBase {
// CHECK-LABEL: sil hidden [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE12CConvenienceACyt_tcfc
// CHECK: objc_method {{%.+}} : $ObjCBase, #ObjCBase.init!initializer.foreign
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC06objcToE12CConvenienceACyt_tcfc'
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE12CConvenienceACyt_tcfcTo
// CHECK-LABEL: sil private [thunk] [ossa] @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE12CConvenienceACyt_tcfcTo
// CHECK: function_ref @$s32convenience_init_peer_delegation8ObjCBaseC06objcToE12CConvenienceACyt_tcfc :
// CHECK: end sil function '$s32convenience_init_peer_delegation8ObjCBaseC06objcToE12CConvenienceACyt_tcfcTo'
@objc convenience init(objcToObjCConvenience: ()) {
Expand Down
8 changes: 4 additions & 4 deletions test/SILGen/convenience_init_peer_delegation_import.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extension ImportedClass {
// CHECK-LABEL: sil hidden [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE16objcToDesignatedAByt_tcfc
// CHECK: objc_method {{%.+}} : $ImportedClass, #ImportedClass.init!initializer.foreign
// CHECK: end sil function '$sSo13ImportedClassC39convenience_init_peer_delegation_importE16objcToDesignatedAByt_tcfc'
// CHECK-LABEL: sil hidden [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE16objcToDesignatedAByt_tcfcTo
// CHECK-LABEL: sil private [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE16objcToDesignatedAByt_tcfcTo
// CHECK: function_ref @$sSo13ImportedClassC39convenience_init_peer_delegation_importE16objcToDesignatedAByt_tcfc :
@objc convenience init(objcToDesignated: ()) {
self.init()
Expand All @@ -55,7 +55,7 @@ extension ImportedClass {
// CHECK-LABEL: sil hidden [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE17objcToConvenienceAByt_tcfc
// CHECK: objc_method {{%.+}} : $ImportedClass, #ImportedClass.init!initializer.foreign
// CHECK: end sil function '$sSo13ImportedClassC39convenience_init_peer_delegation_importE17objcToConvenienceAByt_tcfc'
// CHECK-LABEL: sil hidden [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE17objcToConvenienceAByt_tcfcTo
// CHECK-LABEL: sil private [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE17objcToConvenienceAByt_tcfcTo
// CHECK: function_ref @$sSo13ImportedClassC39convenience_init_peer_delegation_importE17objcToConvenienceAByt_tcfc :
// CHECK: end sil function '$sSo13ImportedClassC39convenience_init_peer_delegation_importE17objcToConvenienceAByt_tcfcTo'
@objc convenience init(objcToConvenience: ()) {
Expand All @@ -71,7 +71,7 @@ extension ImportedClass {
// CHECK-LABEL: sil hidden [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE24objcToConvenienceFactoryAByt_tcfc
// CHECK: objc_method {{%.+}} : $@objc_metatype ImportedClass.Type, #ImportedClass.init!allocator.foreign
// CHECK: end sil function '$sSo13ImportedClassC39convenience_init_peer_delegation_importE24objcToConvenienceFactoryAByt_tcfc'
// CHECK-LABEL: sil hidden [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE24objcToConvenienceFactoryAByt_tcfcTo
// CHECK-LABEL: sil private [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE24objcToConvenienceFactoryAByt_tcfcTo
// CHECK: function_ref @$sSo13ImportedClassC39convenience_init_peer_delegation_importE24objcToConvenienceFactoryAByt_tcfc :
// CHECK: end sil function '$sSo13ImportedClassC39convenience_init_peer_delegation_importE24objcToConvenienceFactoryAByt_tcfcTo'
@objc convenience init(objcToConvenienceFactory: ()) {
Expand All @@ -87,7 +87,7 @@ extension ImportedClass {
// CHECK-LABEL: sil hidden [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE19objcToNormalFactoryAByt_tcfc
// CHECK: objc_method {{%.+}} : $@objc_metatype ImportedClass.Type, #ImportedClass.init!allocator.foreign
// CHECK: end sil function '$sSo13ImportedClassC39convenience_init_peer_delegation_importE19objcToNormalFactoryAByt_tcfc'
// CHECK-LABEL: sil hidden [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE19objcToNormalFactoryAByt_tcfcTo
// CHECK-LABEL: sil private [thunk] [ossa] @$sSo13ImportedClassC39convenience_init_peer_delegation_importE19objcToNormalFactoryAByt_tcfcTo
// CHECK: function_ref @$sSo13ImportedClassC39convenience_init_peer_delegation_importE19objcToNormalFactoryAByt_tcfc :
// CHECK: end sil function '$sSo13ImportedClassC39convenience_init_peer_delegation_importE19objcToNormalFactoryAByt_tcfcTo'
@objc convenience init(objcToNormalFactory: ()) {
Expand Down
24 changes: 12 additions & 12 deletions test/SILGen/dynamic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,25 @@ protocol Proto {
// CHECK-LABEL: sil hidden [exact_self_class] [ossa] @$s7dynamic3FooC{{.*}}tcfC
// CHECK: function_ref @$s7dynamic3FooC{{.*}}tcfc

// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3{{[_0-9a-zA-Z]*}}fcTo
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3FooC10objcMethod{{[_0-9a-zA-Z]*}}FTo
// CHECK-LABEL: sil hidden [transparent] [thunk] [ossa] @$s7dynamic3FooC8objcPropSivgTo
// CHECK-LABEL: sil hidden [transparent] [thunk] [ossa] @$s7dynamic3FooC8objcPropSivsTo
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3FooC4objcSiyXl_tcigTo
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3FooC4objcSiyXl_tcisTo
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3{{[_0-9a-zA-Z]*}}fcTo
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3FooC10objcMethod{{[_0-9a-zA-Z]*}}FTo
// CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s7dynamic3FooC8objcPropSivgTo
// CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s7dynamic3FooC8objcPropSivsTo
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3FooC4objcSiyXl_tcigTo
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3FooC4objcSiyXl_tcisTo

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

// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3{{[_0-9a-zA-Z]*}}fcTo
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3FooC0A6Method{{[_0-9a-zA-Z]*}}FTo
// CHECK-LABEL: sil hidden [transparent] [thunk] [ossa] @$s7dynamic3FooC0A4PropSivgTo
// CHECK-LABEL: sil hidden [transparent] [thunk] [ossa] @$s7dynamic3FooC0A4PropSivsTo
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3FooCAAS2i_tcigTo
// CHECK-LABEL: sil hidden [thunk] [ossa] @$s7dynamic3FooCAAS2i_tcisTo
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3{{[_0-9a-zA-Z]*}}fcTo
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3FooC0A6Method{{[_0-9a-zA-Z]*}}FTo
// CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s7dynamic3FooC0A4PropSivgTo
// CHECK-LABEL: sil private [transparent] [thunk] [ossa] @$s7dynamic3FooC0A4PropSivsTo
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3FooCAAS2i_tcigTo
// CHECK-LABEL: sil private [thunk] [ossa] @$s7dynamic3FooCAAS2i_tcisTo

// Protocol witnesses use best appropriate dispatch

Expand Down
8 changes: 4 additions & 4 deletions test/SILGen/dynamic_accessors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@

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

// CHECK-LABEL: sil [thunk] [ossa] @$s17dynamic_accessors11MyObjCClassC1aSivsTo : $@convention(objc_method) (Int, MyObjCClass) -> () {
// CHECK-LABEL: sil private [thunk] [ossa] @$s17dynamic_accessors11MyObjCClassC1aSivsTo : $@convention(objc_method) (Int, MyObjCClass) -> () {
// CHECK: function_ref @$s17dynamic_accessors11MyObjCClassC1aSivs
// CHECK: }
set {}
}

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

// CHECK-LABEL: sil [thunk] [ossa] @$s17dynamic_accessors11MyObjCClassCyS2icisTo : $@convention(objc_method) (Int, Int, MyObjCClass) -> () {
// CHECK-LABEL: sil private [thunk] [ossa] @$s17dynamic_accessors11MyObjCClassCyS2icisTo : $@convention(objc_method) (Int, Int, MyObjCClass) -> () {
// CHECK: function_ref @$s17dynamic_accessors11MyObjCClassCyS2icis
// CHECK: }
set {}
Expand Down
Loading