@@ -590,16 +590,6 @@ class SILSymbolVisitorImpl : public ASTVisitor<SILSymbolVisitorImpl> {
590
590
addFunction (declRef);
591
591
}
592
592
593
- // Statically/globally stored variables have some special handling.
594
- if (VD->hasStorage () && isGlobalOrStaticVar (VD)) {
595
- if (!shouldSkipVisit (getDeclLinkage (VD))) {
596
- Visitor.addGlobalVar (VD);
597
- }
598
-
599
- if (VD->isLazilyInitializedGlobal ())
600
- addFunction (SILDeclRef (VD, SILDeclRef::Kind::GlobalAccessor));
601
- }
602
-
603
593
// Wrapped non-static member properties may have a backing initializer.
604
594
auto initInfo = VD->getPropertyWrapperInitializerInfo ();
605
595
if (initInfo.hasInitFromWrappedValue () && !VD->isStatic ()) {
@@ -608,6 +598,21 @@ class SILSymbolVisitorImpl : public ASTVisitor<SILSymbolVisitorImpl> {
608
598
}
609
599
}
610
600
601
+ // 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));
613
+ }
614
+ }
615
+
611
616
visitAbstractStorageDecl (VD);
612
617
}
613
618
0 commit comments