mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The use of a synthesized C++ method allows us to avoid making a copy of self when invoking the base method from Swift
16 lines
651 B
Swift
16 lines
651 B
Swift
// RUN: %target-swift-emit-sil -I %S/Inputs -enable-experimental-cxx-interop %s -validate-tbd-against-ir=none | %FileCheck %s
|
|
|
|
import Functions
|
|
|
|
func testGetX() -> CInt {
|
|
let derived = CopyTrackedDerivedClass(42)
|
|
return derived.getX()
|
|
}
|
|
|
|
let _ = testGetX()
|
|
|
|
// CHECK: sil shared @$sSo23CopyTrackedDerivedClassV4getXs5Int32VyF : $@convention(method) (@in_guaranteed CopyTrackedDerivedClass) -> Int32
|
|
// CHECK: {{.*}}(%[[SELF_VAL:.*]] : $*CopyTrackedDerivedClass):
|
|
// CHECK: function_ref @{{.*}}__synthesizedBaseCall_{{.*}} : $@convention(cxx_method) (@in_guaranteed CopyTrackedDerivedClass) -> Int32
|
|
// CHECK-NEXT: apply %{{.*}}(%[[SELF_VAL]])
|