@@ -1054,9 +1054,9 @@ static bool writeLdAddCFileIfNeeded(CompilerInstance &Instance) {
10541054 }
10551055 auto tbdOpts = Invocation.getTBDGenOptions ();
10561056 tbdOpts.LinkerDirectivesOnly = true ;
1057- llvm::StringSet<> ldSymbols;
10581057 auto *module = Instance.getMainModule ();
1059- enumeratePublicSymbols (module , ldSymbols, tbdOpts);
1058+ auto ldSymbols =
1059+ getPublicSymbols (TBDGenDescriptor::forModule (module , tbdOpts));
10601060 std::error_code EC;
10611061 llvm::raw_fd_ostream OS (Path, EC, llvm::sys::fs::F_None);
10621062 if (EC) {
@@ -1074,7 +1074,7 @@ static bool writeLdAddCFileIfNeeded(CompilerInstance &Instance) {
10741074 llvm::raw_svector_ostream NameOS (NameBuffer);
10751075 NameOS << " ldAdd_" << Idx;
10761076 OS << " extern const char " << NameOS.str () << " __asm(\" " <<
1077- changeToLdAdd (S. getKey () ) << " \" );\n " ;
1077+ changeToLdAdd (S) << " \" );\n " ;
10781078 OS << " const char " << NameOS.str () << " = 0;\n " ;
10791079 ++ Idx;
10801080 }
@@ -1501,24 +1501,21 @@ static bool serializeSIB(SILModule *SM, const PrimarySpecificPaths &PSPs,
15011501}
15021502
15031503static GeneratedModule
1504- generateIR (const IRGenOptions &IRGenOpts,
1504+ generateIR (const IRGenOptions &IRGenOpts, const TBDGenOptions &TBDOpts,
15051505 std::unique_ptr<SILModule> SM,
15061506 const PrimarySpecificPaths &PSPs,
15071507 StringRef OutputFilename, ModuleOrSourceFile MSF,
15081508 llvm::GlobalVariable *&HashGlobal,
1509- ArrayRef<std::string> parallelOutputFilenames,
1510- llvm::StringSet<> &LinkerDirectives) {
1509+ ArrayRef<std::string> parallelOutputFilenames) {
15111510 if (auto *SF = MSF.dyn_cast <SourceFile *>()) {
1512- return performIRGeneration (IRGenOpts, *SF ,
1511+ return performIRGeneration (*SF, IRGenOpts, TBDOpts ,
15131512 std::move (SM), OutputFilename, PSPs,
15141513 SF->getPrivateDiscriminator ().str (),
1515- &HashGlobal,
1516- &LinkerDirectives);
1514+ &HashGlobal);
15171515 } else {
1518- return performIRGeneration (IRGenOpts, MSF.get <ModuleDecl *>(),
1516+ return performIRGeneration (MSF.get <ModuleDecl *>(), IRGenOpts, TBDOpts ,
15191517 std::move (SM), OutputFilename, PSPs,
1520- parallelOutputFilenames,
1521- &HashGlobal, &LinkerDirectives);
1518+ parallelOutputFilenames, &HashGlobal);
15221519 }
15231520}
15241521
@@ -1663,17 +1660,6 @@ static bool generateCode(CompilerInstance &Instance, StringRef OutputFilename,
16631660 OutputFilename, Instance.getStatsReporter ());
16641661}
16651662
1666- static void collectLinkerDirectives (const CompilerInvocation &Invocation,
1667- ModuleOrSourceFile MSF,
1668- llvm::StringSet<> &Symbols) {
1669- auto tbdOpts = Invocation.getTBDGenOptions ();
1670- tbdOpts.LinkerDirectivesOnly = true ;
1671- if (MSF.is <SourceFile*>())
1672- enumeratePublicSymbols (MSF.get <SourceFile*>(), Symbols, tbdOpts);
1673- else
1674- enumeratePublicSymbols (MSF.get <ModuleDecl*>(), Symbols, tbdOpts);
1675- }
1676-
16771663static bool performCompileStepsPostSILGen (CompilerInstance &Instance,
16781664 std::unique_ptr<SILModule> SM,
16791665 ModuleOrSourceFile MSF,
@@ -1781,18 +1767,13 @@ static bool performCompileStepsPostSILGen(CompilerInstance &Instance,
17811767 return processCommandLineAndRunImmediately (
17821768 Instance, std::move (SM), MSF, observer, ReturnValue);
17831769
1784- llvm::StringSet<> LinkerDirectives;
1785- collectLinkerDirectives (Invocation, MSF, LinkerDirectives);
1786- // Don't proceed to IRGen if collecting linker directives failed.
1787- if (Context.hadError ())
1788- return true ;
17891770 StringRef OutputFilename = PSPs.OutputFilename ;
17901771 std::vector<std::string> ParallelOutputFilenames =
17911772 opts.InputsAndOutputs .copyOutputFilenames ();
17921773 llvm::GlobalVariable *HashGlobal;
17931774 auto IRModule = generateIR (
1794- IRGenOpts, std::move (SM), PSPs, OutputFilename, MSF, HashGlobal ,
1795- ParallelOutputFilenames, LinkerDirectives );
1775+ IRGenOpts, Invocation. getTBDGenOptions (), std::move (SM), PSPs,
1776+ OutputFilename, MSF, HashGlobal, ParallelOutputFilenames );
17961777
17971778 // Just because we had an AST error it doesn't mean we can't performLLVM.
17981779 bool HadError = Instance.getASTContext ().hadError ();
0 commit comments