mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Textual SIL was sometimes ambiguous when SILDeclRefs were used, because the textual representation of SILDeclRefs was the same for functions that have the same name, but different signatures.
45 lines
1.4 KiB
Plaintext
45 lines
1.4 KiB
Plaintext
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all %s -specdevirt -code-sinking -emit-sorted-sil | %FileCheck %s
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
class Foo {
|
|
func ping() -> Int
|
|
}
|
|
|
|
sil @_TFC4main3Foo4pingfS0_FT_Si : $@convention(method) (@guaranteed Foo) -> Int
|
|
sil @_TFC4main3FoocfMS0_FT_S0_ : $@convention(method) (@owned Foo) -> @owned Foo
|
|
|
|
// CHECK-LABEL: _TF4main7my_mainFCS_3FooSi
|
|
// CHECK: bb0
|
|
// CHECK-NOT: strong_retain
|
|
// CHECK: checked_cast_br [exact] %0 : $Foo to $Foo
|
|
|
|
// CHECK: bb1
|
|
// CHECK: class_method
|
|
// CHECK-NEXT: apply
|
|
// CHECK: strong_release
|
|
|
|
// CHECK: bb2
|
|
// CHECK: function_ref
|
|
// CHECK: apply
|
|
// CHECK: strong_release
|
|
|
|
// CHECK: bb3
|
|
// CHECK-NOT: strong_release
|
|
sil @_TF4main7my_mainFCS_3FooSi : $@convention(thin) (@owned Foo) -> Int {
|
|
bb0(%0 : $Foo):
|
|
debug_value %0 : $Foo, let, name "x" // id: %1
|
|
%3 = class_method %0 : $Foo, #Foo.ping!1 : (Foo) -> () -> Int, $@convention(method) (@guaranteed Foo) -> Int // user: %4
|
|
%4 = apply %3(%0) : $@convention(method) (@guaranteed Foo) -> Int // user: %6
|
|
strong_release %0 : $Foo // id: %5
|
|
return %4 : $Int // id: %6
|
|
}
|
|
|
|
sil_vtable Foo {
|
|
#Foo.ping!1: _TFC4main3Foo4pingfS0_FT_Si // main.Foo.ping (main.Foo)() -> Swift.Int
|
|
#Foo.init!initializer.1: _TFC4main3FoocfMS0_FT_S0_ // main.Foo.init (main.Foo.Type)() -> main.Foo
|
|
}
|