blob: e926fd1a1a01626a60ed66cdaa75ef16b82ca0f9 [file] [log] [blame]
// RUN: %target-swift-frontend -emit-ir %s | %FileCheck %s
sil_stage canonical
// CHECK: define{{( dllexport)?}}{{( protected)?}} swiftcc void @public_fragile_function_test() {{.*}} {
// CHECK: define{{( dllexport)?}}{{( protected)?}} swiftcc void @public_transparent_fragile_function_test() {{.*}} {
// CHECK: define{{( dllexport)?}}{{( protected)?}} swiftcc void @public_transparent_function_test() {{.*}} {
// CHECK: define weak_odr hidden swiftcc void @public_non_abi_function_test() {{.*}} {
// CHECK: define hidden swiftcc void @hidden_fragile_function_test() {{.*}} {
// CHECK: define linkonce_odr hidden swiftcc void @shared_fragile_function_test() {{.*}} {
// CHECK: define{{( internal)?}} swiftcc void @private_fragile_function_test() {{.*}} {
// Public external functions are not emitted into clients.
// CHECK: declare{{( dllimport)?}} swiftcc void @public_external_fragile_function_def_test()
// CHECK: define{{( protected)?}} available_externally{{ (hidden)?}}{{( dllimport)?}} swiftcc void @hidden_external_fragile_function_def_test() {{.*}} {
// CHECK: define linkonce_odr hidden swiftcc void @shared_external_fragile_function_def_test() {{.*}} {
// CHECK: define{{( protected)?}} available_externally{{ (hidden)?}}{{( dllimport)?}} swiftcc void @private_external_fragile_function_def_test() {{.*}} {
// CHECK: define{{( protected)?}}{{( dllexport)?}} swiftcc void @public_resilient_function_test() {{.*}} {
// CHECK: define hidden swiftcc void @hidden_resilient_function_test() {{.*}} {
// CHECK: define linkonce_odr hidden swiftcc void @shared_resilient_function_test() {{.*}} {
// CHECK: define internal swiftcc void @private_resilient_function_test() {{.*}}{
// Public external functions are not emitted into clients.
// CHECK: declare{{( dllimport)?}} swiftcc void @public_external_resilient_function_def_test()
// CHECK: define{{( protected)?}} available_externally hidden{{( dllimport)?}} swiftcc void @hidden_external_resilient_function_def_test() {{.*}} {
// CHECK: define linkonce_odr hidden swiftcc void @shared_external_resilient_function_def_test() {{.*}} {
sil public [serialized] @public_fragile_function_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil public [transparent] [serialized] @public_transparent_fragile_function_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil public [transparent] @public_transparent_function_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil non_abi [serialized] @public_non_abi_function_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil hidden [serialized] @hidden_fragile_function_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil shared [serialized] @shared_fragile_function_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil private [serialized] @private_fragile_function_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil public_external [serialized] @public_external_fragile_function_def_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil hidden_external [serialized] @hidden_external_fragile_function_def_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil shared_external [serialized] @shared_external_fragile_function_def_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil private_external [serialized] @private_external_fragile_function_def_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil public_external [serialized] @public_external_fragile_function_decl_test : $@convention(thin) () -> ()
sil hidden_external [serialized] @hidden_external_fragile_function_decl_test : $@convention(thin) () -> ()
// 'shared' should always be a definition.
// sil shared_external [serialized] @shared_external_fragile_function_decl_test : $@convention(thin) () -> ()
// 'private' should always be a definition.
// sil private_external [serialized] @private_external_fragile_function_decl_test : $@convention(thin) () -> ()
sil public @public_resilient_function_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil hidden @hidden_resilient_function_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil shared @shared_resilient_function_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil private @private_resilient_function_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil public_external @public_external_resilient_function_def_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil hidden_external @hidden_external_resilient_function_def_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil shared_external @shared_external_resilient_function_def_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
// 'private_external' should always be fragile.
// sil private_external @private_external_resilient_function_def_test : $@convention(thin) () -> () {
// %0 = tuple()
// return %0 : $()
// }
sil public_external @public_external_resilient_function_decl_test : $@convention(thin) () -> ()
sil hidden_external @hidden_external_resilient_function_decl_test : $@convention(thin) () -> ()
// 'shared' should always be a definition.
// sil shared_external @shared_external_resilient_function_decl_test : $@convention(thin) () -> ()
// 'private' should always be a definition.
// sil private_external @private_external_resilient_function_decl_test : $@convention(thin) () -> ()
sil public @use_all_symbols : $@convention(thin) () -> () {
%0 = function_ref @public_fragile_function_test : $@convention(thin) () -> ()
%t0 = function_ref @public_transparent_fragile_function_test : $@convention(thin) () -> ()
%t1 = function_ref @public_transparent_function_test : $@convention(thin) () -> ()
%t2 = function_ref @public_non_abi_function_test : $@convention(thin) () -> ()
%1 = function_ref @hidden_fragile_function_test : $@convention(thin) () -> ()
%2 = function_ref @shared_fragile_function_test : $@convention(thin) () -> ()
%3 = function_ref @private_fragile_function_test : $@convention(thin) () -> ()
%4 = function_ref @public_external_fragile_function_def_test : $@convention(thin) () -> ()
%5 = function_ref @hidden_external_fragile_function_def_test : $@convention(thin) () -> ()
%6 = function_ref @shared_external_fragile_function_def_test : $@convention(thin) () -> ()
%7 = function_ref @private_external_fragile_function_def_test : $@convention(thin) () -> ()
%8 = function_ref @public_external_fragile_function_decl_test : $@convention(thin) () -> ()
%9 = function_ref @hidden_external_fragile_function_decl_test : $@convention(thin) () -> ()
// %10 = function_ref @shared_external_fragile_function_decl_test : $@convention(thin) () -> ()
// %11 = function_ref @private_external_fragile_function_decl_test : $@convention(thin) () -> ()
%12 = function_ref @public_resilient_function_test : $@convention(thin) () -> ()
%13 = function_ref @hidden_resilient_function_test : $@convention(thin) () -> ()
%14 = function_ref @shared_resilient_function_test : $@convention(thin) () -> ()
%15 = function_ref @private_resilient_function_test : $@convention(thin) () -> ()
%16 = function_ref @public_external_resilient_function_def_test : $@convention(thin) () -> ()
%17 = function_ref @hidden_external_resilient_function_def_test : $@convention(thin) () -> ()
%18 = function_ref @shared_external_resilient_function_def_test : $@convention(thin) () -> ()
// %19 = function_ref @private_external_resilient_function_def_test : $@convention(thin) () -> ()
%20 = function_ref @public_external_resilient_function_decl_test : $@convention(thin) () -> ()
%21 = function_ref @hidden_external_resilient_function_decl_test : $@convention(thin) () -> ()
// %22 = function_ref @shared_external_resilient_function_decl_test : $@convention(thin) () -> ()
// %23 = function_ref @private_external_resilient_function_decl_test : $@convention(thin) () -> ()
apply %0() : $@convention(thin) () -> ()
apply %1() : $@convention(thin) () -> ()
apply %2() : $@convention(thin) () -> ()
apply %3() : $@convention(thin) () -> ()
apply %4() : $@convention(thin) () -> ()
apply %5() : $@convention(thin) () -> ()
apply %6() : $@convention(thin) () -> ()
apply %7() : $@convention(thin) () -> ()
apply %8() : $@convention(thin) () -> ()
apply %9() : $@convention(thin) () -> ()
// apply %10() : $@convention(thin) () -> ()
// apply %11() : $@convention(thin) () -> ()
apply %12() : $@convention(thin) () -> ()
apply %13() : $@convention(thin) () -> ()
apply %14() : $@convention(thin) () -> ()
apply %15() : $@convention(thin) () -> ()
apply %16() : $@convention(thin) () -> ()
apply %17() : $@convention(thin) () -> ()
apply %18() : $@convention(thin) () -> ()
// apply %19() : $@convention(thin) () -> ()
apply %20() : $@convention(thin) () -> ()
apply %21() : $@convention(thin) () -> ()
// apply %22() : $@convention(thin) () -> ()
// apply %23() : $@convention(thin) () -> ()
%24 = tuple()
return %24 : $()
}