mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #9313 from huonw/symbol-list-7
TBD: ivar init/destroy, materializeForSet callbacks
This commit is contained in:
@@ -371,6 +371,12 @@ SILLinkage SILDeclRef::getLinkage(ForDefinition_t forDefinition) const {
|
||||
return SILLinkage::Private;
|
||||
}
|
||||
|
||||
// Add External to the linkage (e.g. Public -> PublicExternal) if this is a
|
||||
// declaration not a definition.
|
||||
auto maybeAddExternal = [&](SILLinkage linkage) {
|
||||
return forDefinition ? linkage : addExternalToLinkage(linkage);
|
||||
};
|
||||
|
||||
// Native function-local declarations have shared linkage.
|
||||
// FIXME: @objc declarations should be too, but we currently have no way
|
||||
// of marking them "used" other than making them external.
|
||||
@@ -392,15 +398,25 @@ SILLinkage SILDeclRef::getLinkage(ForDefinition_t forDefinition) const {
|
||||
switch (d->getEffectiveAccess()) {
|
||||
case Accessibility::Private:
|
||||
case Accessibility::FilePrivate:
|
||||
return (forDefinition
|
||||
? SILLinkage::Private
|
||||
: SILLinkage::PrivateExternal);
|
||||
return maybeAddExternal(SILLinkage::Private);
|
||||
|
||||
default:
|
||||
return SILLinkage::Shared;
|
||||
}
|
||||
}
|
||||
|
||||
// ivar initializers and destroyers are completely contained within the class
|
||||
// from which they come, and never get seen externally.
|
||||
if (isIVarInitializerOrDestroyer()) {
|
||||
switch (d->getEffectiveAccess()) {
|
||||
case Accessibility::Private:
|
||||
case Accessibility::FilePrivate:
|
||||
return maybeAddExternal(SILLinkage::Private);
|
||||
default:
|
||||
return maybeAddExternal(SILLinkage::Hidden);
|
||||
}
|
||||
}
|
||||
|
||||
// Calling convention thunks have shared linkage.
|
||||
if (isForeignToNativeThunk())
|
||||
return SILLinkage::Shared;
|
||||
@@ -418,13 +434,13 @@ SILLinkage SILDeclRef::getLinkage(ForDefinition_t forDefinition) const {
|
||||
switch (d->getEffectiveAccess()) {
|
||||
case Accessibility::Private:
|
||||
case Accessibility::FilePrivate:
|
||||
return (forDefinition ? SILLinkage::Private : SILLinkage::PrivateExternal);
|
||||
return maybeAddExternal(SILLinkage::Private);
|
||||
|
||||
case Accessibility::Internal:
|
||||
return (forDefinition ? SILLinkage::Hidden : SILLinkage::HiddenExternal);
|
||||
return maybeAddExternal(SILLinkage::Hidden);
|
||||
|
||||
default:
|
||||
return (forDefinition ? SILLinkage::Public : SILLinkage::PublicExternal);
|
||||
return maybeAddExternal(SILLinkage::Public);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user