mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
SIL: Ignore AEIC on package declaration inside declarations without effective public access
Quoting Slava: "The AST-level access is allowed to be 'more public'. I honestly don't know why, but it's always worked this way and the 'lowered' access levels must always intersect the access levels of the parents but with @uic, @aeic and @inlinable, that means just ignoring those attributes if some enclosing context is not @uic" rdar://128270848
This commit is contained in:
@@ -625,7 +625,11 @@ SILLinkage SILDeclRef::getDefinitionLinkage() const {
|
||||
case Limit::None:
|
||||
return SILLinkage::Package;
|
||||
case Limit::AlwaysEmitIntoClient:
|
||||
return SILLinkage::PackageNonABI;
|
||||
// Drop the AEIC if the enclosing decl is not effectively public.
|
||||
// This matches what we do in the `internal` case.
|
||||
if (isSerialized())
|
||||
return SILLinkage::PackageNonABI;
|
||||
else return SILLinkage::Package;
|
||||
case Limit::OnDemand:
|
||||
return SILLinkage::Shared;
|
||||
case Limit::NeverPublic:
|
||||
|
||||
@@ -58,3 +58,21 @@ public final class C {
|
||||
@_alwaysEmitIntoClient
|
||||
deinit {}
|
||||
}
|
||||
|
||||
|
||||
// We drop AEIC if the containing context does not have effective public
|
||||
// visibility.
|
||||
internal struct InternalContext {
|
||||
// CHECK-LABEL: sil hidden [ossa] @$s33always_emit_into_client_attribute15InternalContextV1vSivgZ
|
||||
@_alwaysEmitIntoClient
|
||||
internal static var v : Int { 1 }
|
||||
}
|
||||
|
||||
// We drop AEIC if the containing context does not have effective public
|
||||
// visibility.
|
||||
package struct PackageContext {
|
||||
// CHECK-LABEL: sil package [ossa] @$s33always_emit_into_client_attribute14PackageContextV1vSivgZ
|
||||
|
||||
@_alwaysEmitIntoClient
|
||||
package static var v : Int { 1 }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user