SIL: Enum case constructors are fragile if the enum is public or @_versioned

This commit is contained in:
Slava Pestov
2017-01-29 22:34:12 -08:00
parent b83bb7d614
commit 5ce84060ca
2 changed files with 20 additions and 1 deletions

View File

@@ -499,9 +499,16 @@ bool SILDeclRef::isFragile() const {
DeclContext *dc;
if (auto closure = getAbstractClosureExpr())
dc = closure->getLocalContext();
else
else {
dc = getDecl()->getInnermostDeclContext();
// Enum case constructors are serialized if the enum is @_versioned
// or public.
if (isEnumElement())
if (cast<EnumDecl>(dc)->getEffectiveAccess() >= Accessibility::Public)
return true;
}
// This is stupid
return (dc->getResilienceExpansion() == ResilienceExpansion::Minimal);
}