Skip to content

Commit 12d14bb

Browse files
committed
[TBD] Don't add main entrypoint for statically linked libs
Only add the main symbol for the current module we're emitting TBD for. This is to avoid hitting a duplicate symbol assertion when we start always passing a StringSet to TBDGenVisitor.
1 parent 4867c5f commit 12d14bb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/TBDGen/TBDGenVisitor.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ class TBDGenVisitor : public ASTVisitor<TBDGenVisitor> {
113113
// HACK: 'main' is a special symbol that's always emitted in SILGen if
114114
// the file has an entry point. Since it doesn't show up in the
115115
// module until SILGen, we need to explicitly add it here.
116-
if (file->hasEntryPoint())
116+
//
117+
// Make sure to only add the main symbol for the module that we're emitting
118+
// TBD for, and not for any statically linked libraries.
119+
if (file->hasEntryPoint() && file->getParentModule() == SwiftModule)
117120
addSymbol("main");
118121
}
119122

0 commit comments

Comments
 (0)