mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
The main point of this change is to make sure that a shared function always has a body: both, in the optimizer pipeline and in the swiftmodule file. This is important because the compiler always needs to emit code for a shared function. Shared functions cannot be referenced from outside the module. In several corner cases we missed to maintain this invariant which resulted in unresolved-symbol linker errors. As side-effect of this change we can drop the shared_external SIL linkage and the IsSerializable flag, which simplifies the serialization and linkage concept.
56 lines
1.5 KiB
Plaintext
56 lines
1.5 KiB
Plaintext
// RUN: %target-sil-opt %s | %target-sil-opt | %FileCheck %s
|
|
|
|
sil_stage raw // CHECK: sil_stage raw
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
// CHECK-LABEL: sil @public_definition : $@convention(thin) () -> ()
|
|
sil @public_definition : $() -> () {
|
|
bb0:
|
|
%0 = tuple ()
|
|
return %0 : $()
|
|
}
|
|
|
|
// CHECK-LABEL: sil non_abi [serialized] @always_emit_into_client_definition : $@convention(thin) () -> ()
|
|
sil non_abi [serialized] @always_emit_into_client_definition : $() -> () {
|
|
bb0:
|
|
%0 = tuple ()
|
|
return %0 : $()
|
|
}
|
|
|
|
// CHECK-LABEL: sil shared @shared_definition : $@convention(thin) () -> ()
|
|
sil shared @shared_definition : $() -> () {
|
|
bb0:
|
|
%0 = tuple ()
|
|
return %0 : $()
|
|
}
|
|
|
|
// CHECK-LABEL: sil hidden @hidden_definition : $@convention(thin) () -> ()
|
|
sil hidden @hidden_definition : $() -> () {
|
|
bb0:
|
|
%0 = tuple ()
|
|
return %0 : $()
|
|
}
|
|
|
|
// CHECK-LABEL: sil private @private_definition : $@convention(thin) () -> ()
|
|
sil private @private_definition : $() -> () {
|
|
bb0:
|
|
%0 = tuple ()
|
|
return %0 : $()
|
|
}
|
|
|
|
// CHECK-LABEL: sil public_external [serialized] @public_available_externally_definition : $@convention(thin) () -> ()
|
|
sil public_external [serialized] @public_available_externally_definition : $() -> () {
|
|
bb0:
|
|
%0 = tuple ()
|
|
return %0 : $()
|
|
}
|
|
|
|
// CHECK-LABEL: sil @public_declaration : $@convention(thin) () -> ()
|
|
sil @public_declaration : $() -> ()
|
|
|
|
// CHECK-LABEL: sil hidden_external @hidden_declaration : $@convention(thin) () -> ()
|
|
sil hidden_external @hidden_declaration : $() -> ()
|
|
|