mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Introduce '@_alwaysEmitIntoClient' attribute for use by standard library
This is like '@inlinable', except that the symbol does not have a public entry point in the generated binary at all; it is deserialized and a copy is always emitted into the client binary, with shared linkage. Just like '@inlinable', if you apply this to an internal declaration it becomes '@usableFromInline' automatically. This uses the same mechanism as default arguments ever since Swift 4, so it should work reasonably well, but there are rough edges with diagnostics and such. Don't use this if you are not the standard library. Fixes <rdar://problem/33767512>, <https://bugs.swift.org/browse/SR-5646>.
This commit is contained in:
@@ -390,6 +390,9 @@ DECL_ATTR(_private, PrivateImport,
|
||||
OnImport |
|
||||
UserInaccessible |
|
||||
NotSerialized, 82)
|
||||
SIMPLE_DECL_ATTR(_alwaysEmitIntoClient, AlwaysEmitIntoClient,
|
||||
OnVar | OnSubscript | OnAbstractFunction | UserInaccessible,
|
||||
83)
|
||||
|
||||
#undef TYPE_ATTR
|
||||
#undef DECL_ATTR_ALIAS
|
||||
|
||||
@@ -4082,6 +4082,7 @@ ERROR(usable_from_inline_attr_in_protocol,none,
|
||||
#define FRAGILE_FUNC_KIND \
|
||||
"%select{a '@_transparent' function|" \
|
||||
"an '@inlinable' function|" \
|
||||
"an '@_alwaysEmitIntoClient' function|" \
|
||||
"a default argument value|" \
|
||||
"a property initializer in a '@_fixed_layout' type}"
|
||||
|
||||
@@ -4115,7 +4116,7 @@ NOTE(resilience_decl_declared_here,
|
||||
|
||||
ERROR(class_designated_init_inlinable_resilient,none,
|
||||
"initializer for class %0 is "
|
||||
"'%select{@_transparent|@inlinable|%error}1' and must "
|
||||
"'%select{@_transparent|@inlinable|@_alwaysEmitIntoClient|%error}1' and must "
|
||||
"delegate to another initializer", (Type, unsigned))
|
||||
|
||||
ERROR(attribute_invalid_on_stored_property,
|
||||
|
||||
@@ -52,7 +52,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
|
||||
/// describe what change you made. The content of this comment isn't important;
|
||||
/// it just ensures a conflict if two people change the module format.
|
||||
/// Don't worry about adhering to the 80-column limit for this line.
|
||||
const uint16_t SWIFTMODULE_VERSION_MINOR = 473; // Last change: assign ownership qualifier
|
||||
const uint16_t SWIFTMODULE_VERSION_MINOR = 474; // Last change: @_alwaysEmitIntoClient
|
||||
|
||||
using DeclIDField = BCFixed<31>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user