mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Derive the SIL linkage of a witness table from the minimum of the protocol’s and conforming type’s visibility.
For example, if an internal type conforms to a public protocol, the witness table should get internal linkage. Previously we only considered the visibility of the protocol. Fragile witness tables still have to get public symbol linkage. This is now handled in IRGen (like we do it for functions).
This commit is contained in:
@@ -129,14 +129,9 @@ swift::getLinkageForProtocolConformance(const NormalProtocolConformance *C,
|
||||
&& conformanceModule == typeUnit->getParentModule())
|
||||
return SILLinkage::Shared;
|
||||
|
||||
// If we're building with -sil-serialize-all, give the conformance public
|
||||
// linkage.
|
||||
if (conformanceModule->getResilienceStrategy()
|
||||
== ResilienceStrategy::Fragile)
|
||||
return (definition ? SILLinkage::Public : SILLinkage::PublicExternal);
|
||||
|
||||
// FIXME: This should be using std::min(protocol's access, type's access).
|
||||
switch (C->getProtocol()->getEffectiveAccess()) {
|
||||
Accessibility accessibility = std::min(C->getProtocol()->getEffectiveAccess(),
|
||||
typeDecl->getEffectiveAccess());
|
||||
switch (accessibility) {
|
||||
case Accessibility::Private:
|
||||
case Accessibility::FilePrivate:
|
||||
return (definition ? SILLinkage::Private : SILLinkage::PrivateExternal);
|
||||
|
||||
Reference in New Issue
Block a user