Skip to content

Commit 58cc800

Browse files
committed
Unconditionally add global vars
1 parent e3cce07 commit 58cc800

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/SIL/IR/SILSymbolVisitor.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -599,18 +599,18 @@ class SILSymbolVisitorImpl : public ASTVisitor<SILSymbolVisitorImpl> {
599599
}
600600

601601
// Statically/globally stored variables have some special handling.
602-
// Global accessor gets no linkage limit in the same resilience domain,
603-
// e.g. in package with non-resilient access optimizations enabled,
604-
// so it should be added in such case.
605-
if (!VD->isResilient() ||
606-
VD->getModuleContext()->allowNonResilientAccess()) {
607-
if (VD->hasStorage() && isGlobalOrStaticVar(VD)) {
608-
if (!shouldSkipVisit(getDeclLinkage(VD))) {
609-
Visitor.addGlobalVar(VD);
610-
}
611-
if (VD->isLazilyInitializedGlobal())
612-
addFunction(SILDeclRef(VD, SILDeclRef::Kind::GlobalAccessor));
602+
// Global accessor should get no linkage limit and get non-hidden
603+
// linkage in the same resilience domain, e.g. in the same package,
604+
// so add them regardless of whether modules are built resiliently
605+
// or not. If module is built resiliently without non-resilience
606+
// package optimization, it gets a hidden linkage and gets ignored
607+
// anyway, so there's no harm in doing so.
608+
if (VD->hasStorage() && isGlobalOrStaticVar(VD)) {
609+
if (!shouldSkipVisit(getDeclLinkage(VD))) {
610+
Visitor.addGlobalVar(VD);
613611
}
612+
if (VD->isLazilyInitializedGlobal())
613+
addFunction(SILDeclRef(VD, SILDeclRef::Kind::GlobalAccessor));
614614
}
615615

616616
visitAbstractStorageDecl(VD);

0 commit comments

Comments
 (0)