Files
swift-mirror/test/SILOptimizer/no-external-defs-onone.sil
Roman Levenstein 6f3b326d12 IRGen should not emit bodies of public_external functions unless it is a transparent function.
Recent changes that eliminated the -sil-serialize-all mode and adding this check to IRGen allow us to get rid of ExternalFunctionDefinitionsElimination and ExternalDefsToDecls passes, which are not needed anymore.
2017-10-11 08:29:46 -07:00

43 lines
1.3 KiB
Plaintext

// RUN: %target-swift-frontend -module-name=test -Onone -emit-ir %s | %FileCheck %s
// CHECK-DAG: define linkonce_odr hidden swiftcc void @shared_external_test()
// CHECK-DAG: declare swiftcc void @public_external_test()
// Non-public external symbols are emitted into clients.
// CHECK-DAG: define available_externally hidden swiftcc void @hidden_external_test()
// CHECK-NOT: public_external_unused_test
sil public_external @public_external_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil hidden_external @hidden_external_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil shared_external @shared_external_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil public_external @public_external_unused_test : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil public @use_all_symbols : $@convention(thin) () -> () {
%0 = function_ref @public_external_test : $@convention(thin) () -> ()
%1 = function_ref @hidden_external_test : $@convention(thin) () -> ()
%2 = function_ref @shared_external_test : $@convention(thin) () -> ()
apply %0() : $@convention(thin) () -> ()
apply %1() : $@convention(thin) () -> ()
apply %2() : $@convention(thin) () -> ()
%24 = tuple()
return %24 : $()
}