mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
19 lines
776 B
Plaintext
19 lines
776 B
Plaintext
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s -DINT=i%target-ptrsize
|
|
|
|
import Swift
|
|
|
|
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} void @c_native_function_pointer(ptr %0)
|
|
sil @c_native_function_pointer : $@convention(c) (@convention(c) () -> ()) -> () {
|
|
entry(%f : $@convention(c) () -> ()):
|
|
return undef : $()
|
|
}
|
|
|
|
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} swiftcc void @call_with_native_c_function_pointer(ptr %0)
|
|
sil @call_with_native_c_function_pointer : $@convention(thin) (@convention(c) () -> ()) -> () {
|
|
entry(%f : $@convention(c) () -> ()):
|
|
%c = function_ref @c_native_function_pointer : $@convention(c) (@convention(c) () -> ()) -> ()
|
|
%z = apply %c(%f) : $@convention(c) (@convention(c) () -> ()) -> ()
|
|
return %z : $()
|
|
}
|
|
|