@@ -41,21 +41,6 @@ static bool isGlobalOrStaticVar(VarDecl *VD) {
41
41
return VD->isStatic () || VD->getDeclContext ()->isModuleScopeContext ();
42
42
}
43
43
44
- void TBDGenVisitor::visitPatternBindingDecl (PatternBindingDecl *PBD) {
45
- for (auto &entry : PBD->getPatternList ()) {
46
- auto *var = entry.getAnchoringVarDecl ();
47
-
48
- // Non-global variables might have an explicit initializer symbol.
49
- if (entry.getNonLazyInit () && !isGlobalOrStaticVar (var)) {
50
- auto declRef =
51
- SILDeclRef (var, SILDeclRef::Kind::StoredPropertyInitializer);
52
- // Stored property initializers for public properties are currently
53
- // public.
54
- addSymbol (declRef);
55
- }
56
- }
57
- }
58
-
59
44
void TBDGenVisitor::addSymbol (SILDeclRef declRef) {
60
45
auto linkage = effectiveLinkageForClassMember (
61
46
declRef.getLinkage (ForDefinition),
@@ -169,6 +154,17 @@ void TBDGenVisitor::visitAbstractStorageDecl(AbstractStorageDecl *ASD) {
169
154
}
170
155
171
156
void TBDGenVisitor::visitVarDecl (VarDecl *VD) {
157
+ // Non-global variables might have an explicit initializer symbol, in
158
+ // non-resilient modules.
159
+ if (VD->getAttrs ().hasAttribute <HasInitialValueAttr>() &&
160
+ SwiftModule->getResilienceStrategy () == ResilienceStrategy::Default &&
161
+ !isGlobalOrStaticVar (VD)) {
162
+ auto declRef = SILDeclRef (VD, SILDeclRef::Kind::StoredPropertyInitializer);
163
+ // Stored property initializers for public properties are currently
164
+ // public.
165
+ addSymbol (declRef);
166
+ }
167
+
172
168
// statically/globally stored variables have some special handling.
173
169
if (VD->hasStorage () && isGlobalOrStaticVar (VD)) {
174
170
if (getDeclLinkage (VD) == FormalLinkage::PublicUnique) {
0 commit comments