blob: e9f000674ebca85834f524a7ec93b4aefc054609 [file] [log] [blame]
// 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(void ()*)
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(i8*)
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 : $()
}