Skip to content

Commit 39110ec

Browse files
huonwHarlan Haskins
authored andcommitted
[TBDGen] Don't list symbols for non-public static/global stored variables.
1 parent 45ddfa9 commit 39110ec

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

lib/TBDGen/TBDGen.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,11 @@ void TBDGenVisitor::visitAbstractStorageDecl(AbstractStorageDecl *ASD) {
207207
void TBDGenVisitor::visitVarDecl(VarDecl *VD) {
208208
// statically/globally stored variables have some special handling.
209209
if (VD->hasStorage() && isGlobalOrStaticVar(VD)) {
210-
// The actual variable has a symbol.
211-
Mangle::ASTMangler mangler;
212-
addSymbol(mangler.mangleEntity(VD, false));
210+
if (getDeclLinkage(VD) == FormalLinkage::PublicUnique) {
211+
// The actual variable has a symbol.
212+
Mangle::ASTMangler mangler;
213+
addSymbol(mangler.mangleEntity(VD, false));
214+
}
213215

214216
if (VD->isLazilyInitializedGlobal())
215217
addSymbol(SILDeclRef(VD, SILDeclRef::Kind::GlobalAccessor));

test/TBD/global.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing %s
2-
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing -enable-resilience %s
3-
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing %s -enable-testing
4-
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing -enable-resilience -enable-testing %s
5-
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing %s -O
6-
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing -enable-resilience %s -O
7-
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing %s -enable-testing -O
8-
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=missing -enable-resilience -enable-testing %s -O
1+
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=all %s
2+
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=all -enable-resilience %s
3+
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=all %s -enable-testing
4+
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=all -enable-resilience -enable-testing %s
5+
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=all %s -O
6+
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=all -enable-resilience %s -O
7+
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=all %s -enable-testing -O
8+
// RUN: %target-swift-frontend -emit-ir -o/dev/null -parse-as-library -module-name test -validate-tbd-against-ir=all -enable-resilience -enable-testing %s -O
99

1010
// RUN: %empty-directory(%t)
1111
// RUN: %target-swift-frontend -typecheck -parse-as-library -module-name test %s -emit-tbd -emit-tbd-path %t/typecheck.tbd

0 commit comments

Comments
 (0)