Files
swift-mirror/test/IRGen/error_self_conformance.sil
Alex Lorenz 4858cb6225 [IRGen][interop] do not add 'nocapture' to not bitwise takable types
The use of 'nocapture' for parameters and return values is incorrect for C++ types, as they can actually capture a pointer into its own value (e.g. std::string in libstdc++)

rdar://115062687
2023-09-25 17:43:34 -07:00

27 lines
1015 B
Plaintext

// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s -DINT=i%target-ptrsize
import Swift
sil @take_any_error : $@convention(thin) <T: Error> (@in T) -> ()
// CHECK-LABEL: swiftcc void @test(ptr
sil @test : $@convention(thin) (@in Error) -> () {
entry(%0 : $*Error):
// CHECK: [[ERROR_METADATA:%.*]] = call {{.*}}@"$ss5Error_pMD"
// CHECK-NEXT: call swiftcc void @take_any_error(ptr noalias %0, ptr [[ERROR_METADATA]], ptr @"$ss5ErrorWS")
// CHECK-NEXT: ret void
%take = function_ref @take_any_error : $@convention(thin) <T: Error> (@in T) -> ()
apply %take<Error>(%0) : $@convention(thin) <T: Error> (@in T) -> ()
%ret = tuple ()
return %ret : $()
}
sil @partial_apply_test : $@convention(thin) (@in Error) -> () {
entry(%0 : $*Error):
%take = function_ref @take_any_error : $@convention(thin) <T: Error> (@in T) -> ()
%fn = partial_apply %take<Error>(%0) : $@convention(thin) <T: Error> (@in T) -> ()
release_value %fn : $@callee_owned () ->()
%ret = tuple ()
return %ret : $()
}