Skip to content

Commit 1c622fd

Browse files
committed
[TBDGen] Don't list symbols for non-public static/global stored variables.
1 parent df923d9 commit 1c622fd

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

Diff for: lib/TBDGen/TBDGen.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,11 @@ void TBDGenVisitor::visitAbstractStorageDecl(AbstractStorageDecl *ASD) {
171171
void TBDGenVisitor::visitVarDecl(VarDecl *VD) {
172172
// statically/globally stored variables have some special handling.
173173
if (VD->hasStorage() && isGlobalOrStaticVar(VD)) {
174-
// The actual variable has a symbol.
175-
Mangle::ASTMangler mangler;
176-
addSymbol(mangler.mangleEntity(VD, false));
174+
if (getDeclLinkage(VD) == FormalLinkage::PublicUnique) {
175+
// The actual variable has a symbol.
176+
Mangle::ASTMangler mangler;
177+
addSymbol(mangler.mangleEntity(VD, false));
178+
}
177179

178180
// Top-level variables (*not* statics) in the main file don't get accessors,
179181
// despite otherwise looking like globals.

Diff for: test/TBD/global.swift

+8-8
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
public let publicLet: Int = 0
1111
internal let internalLet: Int = 0

0 commit comments

Comments
 (0)