// RUN: %target-swift-frontend -emit-ir %s | FileCheck %s import Swift // CHECK-LABEL: define{{( 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{{( protected)?}} 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 : $() } // CHECK-LABEL: define{{( protected)?}} %swift.type* @c_function_pointer_metadata() sil @c_function_pointer_metadata : $@convention(thin) () -> @thick Any.Type { entry: // CHECK: call %swift.type* @_TMacT_T_() %m = metatype $@thick (@convention(c) () -> ()).Type %a = init_existential_metatype %m : $@thick (@convention(c) () -> ()).Type, $@thick Any.Type return %a : $@thick Any.Type } // CHECK-LABEL: define linkonce_odr hidden %swift.type* @_TMacT_T_() // -- 0x3000001 -- C convention, 1 argument // CHECK: call %swift.type* @swift_getFunctionTypeMetadata1([[WORD:i(32|64)]] 50331649