Skip to content

Commit 15afed5

Browse files
authored
Merge pull request #16147 from slavapestov/autolinking-fixes
IRGen: Remove collectLinkLibrariesFromExternals()
2 parents cd8ccbd + 7e4da52 commit 15afed5

File tree

3 files changed

+0
-45
lines changed

3 files changed

+0
-45
lines changed

include/swift/IRGen/IRGenPublic.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,6 @@ createIRGenModule(SILModule *SILMod, StringRef OutputFilename,
3636
/// Delete the IRGenModule and IRGenerator obtained by the above call.
3737
void deleteIRGenModule(std::pair<IRGenerator *, IRGenModule *> &Module);
3838

39-
/// Collect the set of libraries to autolink against by mining the
40-
/// external definitions stored in an AST context.
41-
///
42-
/// This entire thing is a hack that we shouldn't need, but it reflects the
43-
/// fact that we can end up referencing something via an external definition
44-
/// (e.g., an imported Clang declaration) indirectly via the Clang importer
45-
/// that would not be visible directly. In such cases, we would fail to
46-
/// link against the shared library that defines the entity or an overlay that
47-
/// is needed as part of its import from Clang (e.g., the Foundation overlay
48-
/// is needed when bridging NSString, even if there is no other mention of
49-
/// an entity from the Foundation overlay).
50-
llvm::SmallVector<LinkLibrary, 4> collectLinkLibrariesFromExternals(
51-
ASTContext &ctx);
52-
5339
} // end namespace irgen
5440
} // end namespace swift
5541

lib/IRGen/IRGen.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -793,10 +793,6 @@ static std::unique_ptr<llvm::Module> performIRGeneration(IRGenOptions &Opts,
793793
IGM.addLinkLibrary(linkLib);
794794
});
795795

796-
// Hack to handle thunks eagerly synthesized by the Clang importer.
797-
for (const auto &linkLib : collectLinkLibrariesFromExternals(Ctx))
798-
IGM.addLinkLibrary(linkLib);
799-
800796
if (!IGM.finalize())
801797
return nullptr;
802798

@@ -966,10 +962,6 @@ static void performParallelIRGeneration(
966962
PrimaryGM->addLinkLibrary(linkLib);
967963
});
968964

969-
// Hack to handle thunks eagerly synthesized by the Clang importer.
970-
for (const auto &linkLib : collectLinkLibrariesFromExternals(Ctx))
971-
PrimaryGM->addLinkLibrary(linkLib);
972-
973965
llvm::StringSet<> referencedGlobals;
974966

975967
for (auto it = irgen.begin(); it != irgen.end(); ++it) {
@@ -1150,20 +1142,3 @@ bool swift::performLLVM(IRGenOptions &Opts, ASTContext &Ctx,
11501142
return true;
11511143
return false;
11521144
}
1153-
1154-
SmallVector<LinkLibrary, 4> irgen::collectLinkLibrariesFromExternals(
1155-
ASTContext &ctx) {
1156-
SmallVector<LinkLibrary, 4> result;
1157-
auto addLinkLibrary = [&](LinkLibrary linkLib) {
1158-
result.push_back(linkLib);
1159-
};
1160-
1161-
llvm::SmallPtrSet<ModuleDecl *, 8> known;
1162-
for (auto external : ctx.ExternalDefinitions) {
1163-
swift::ModuleDecl *module = external->getModuleContext();
1164-
if (known.insert(module).second)
1165-
module->collectLinkLibraries(addLinkLibrary);
1166-
}
1167-
1168-
return result;
1169-
}

lib/Immediate/Immediate.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,6 @@ bool swift::immediate::IRGenImportedModules(
224224
import.second->collectLinkLibraries(addLinkLibrary);
225225
});
226226

227-
// Hack to handle thunks eagerly synthesized by the Clang importer.
228-
for (const auto &linkLib :
229-
irgen::collectLinkLibrariesFromExternals(CI.getASTContext())) {
230-
addLinkLibrary(linkLib);
231-
}
232-
233227
tryLoadLibraries(AllLinkLibraries, CI.getASTContext().SearchPathOpts,
234228
CI.getDiags());
235229

0 commit comments

Comments
 (0)