mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SILGen] Serialize and give PublicNonABI linkage to property wrapper
generator functions for parameters of public functions.
This commit is contained in:
@@ -248,8 +248,15 @@ SILLinkage SILDeclRef::getLinkage(ForDefinition_t forDefinition) const {
|
||||
return forDefinition ? linkage : addExternalToLinkage(linkage);
|
||||
};
|
||||
|
||||
// Function-local declarations have private linkage, unless serialized.
|
||||
ValueDecl *d = getDecl();
|
||||
|
||||
// Property wrapper generators of public functions have PublicNonABI linkage
|
||||
if (isPropertyWrapperBackingInitializer() && isa<ParamDecl>(d)) {
|
||||
if (isSerialized())
|
||||
return maybeAddExternal(SILLinkage::PublicNonABI);
|
||||
}
|
||||
|
||||
// Function-local declarations have private linkage, unless serialized.
|
||||
DeclContext *moduleContext = d->getDeclContext();
|
||||
while (!moduleContext->isModuleScopeContext()) {
|
||||
if (moduleContext->isLocalContext()) {
|
||||
@@ -488,9 +495,16 @@ IsSerialized_t SILDeclRef::isSerialized() const {
|
||||
|
||||
auto *d = getDecl();
|
||||
|
||||
// Default argument generators are serialized if the containing
|
||||
// declaration is public.
|
||||
if (isDefaultArgGenerator()) {
|
||||
// Default and property wrapper argument generators are serialized if the
|
||||
// containing declaration is public.
|
||||
if (isDefaultArgGenerator() || (isPropertyWrapperBackingInitializer() &&
|
||||
isa<ParamDecl>(d))) {
|
||||
if (isPropertyWrapperBackingInitializer()) {
|
||||
if (auto *func = dyn_cast_or_null<ValueDecl>(d->getDeclContext()->getAsDecl())) {
|
||||
d = func;
|
||||
}
|
||||
}
|
||||
|
||||
// Ask the AST if we're inside an @inlinable context.
|
||||
if (d->getDeclContext()->getResilienceExpansion()
|
||||
== ResilienceExpansion::Minimal) {
|
||||
|
||||
Reference in New Issue
Block a user