Files
swift-mirror/test/Interop/Cxx/class/inheritance/functions-silgen.swift
Alex Lorenz ba5b1bab89 [cxx-interop] Use a synthesized C++ method when invoking a base method from a derived class synthesized method
The use of a synthesized C++ method allows us to avoid making a copy of self when invoking the base method from Swift
2023-09-29 13:52:10 -07:00

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]])