blob: 7b0f0c2fcd47eceb04e857230f3600dbd1ed2570 [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 ()* %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(i8* %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 : $()
}