mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This is going to be used for "always emit into client" functions, such as default argument generators and stored property initializers. - In dead function elimination, these functions behave identically to public functions, serving as "anchors" for the mark-and-sweep analysis. - There is no external variant of this linkage, because external declarations can use HiddenExternal linkage -- the definition should always be emitted by another translation unit in the same Swift module. - When deserialized, they receive shared linkage, because we want the linker to coalesce multiple copies of the same deserialized definition if it was deserialized from multiple translation units in the same Swift module. - When IRGen emits a definition with this linkage, it receives the same LLVM-level linkage as a hidden definition, ensuring it does not have a public entry point.
56 lines
1.4 KiB
Plaintext
56 lines
1.4 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 @always_emit_into_client_definition : $@convention(thin) () -> ()
|
|
sil non_abi @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 @public_available_externally_definition : $@convention(thin) () -> ()
|
|
sil public_external @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 : $() -> ()
|
|
|