@@ -682,63 +682,6 @@ static bool writeTBDIfNeeded(CompilerInstance &Instance) {
682682 return writeTBD (Instance.getMainModule (), TBDPath, tbdOpts);
683683}
684684
685- static std::string changeToLdAdd (StringRef ldHide) {
686- SmallString<64 > SymbolBuffer;
687- llvm::raw_svector_ostream OS (SymbolBuffer);
688- auto Parts = ldHide.split (" $hide$" );
689- assert (!Parts.first .empty ());
690- assert (!Parts.second .empty ());
691- OS << Parts.first << " $add$" << Parts.second ;
692- return OS.str ().str ();
693- }
694-
695- static bool writeLdAddCFileIfNeeded (CompilerInstance &Instance) {
696- const auto &Invocation = Instance.getInvocation ();
697- const auto &frontendOpts = Invocation.getFrontendOptions ();
698- if (!frontendOpts.InputsAndOutputs .isWholeModule ())
699- return false ;
700- auto Path = Invocation.getLdAddCFileOutputPathForWholeModule ();
701- if (Path.empty ())
702- return false ;
703- if (!frontendOpts.InputsAndOutputs .isWholeModule ()) {
704- Instance.getDiags ().diagnose (SourceLoc (),
705- diag::tbd_only_supported_in_whole_module);
706- return true ;
707- }
708- if (!Invocation.getTBDGenOptions ().ModuleInstallNameMapPath .empty ()) {
709- Instance.getDiags ().diagnose (SourceLoc (),
710- diag::linker_directives_choice_confusion);
711- return true ;
712- }
713- auto tbdOpts = Invocation.getTBDGenOptions ();
714- tbdOpts.LinkerDirectivesOnly = true ;
715- auto *module = Instance.getMainModule ();
716- auto ldSymbols =
717- getPublicSymbols (TBDGenDescriptor::forModule (module , tbdOpts));
718- std::error_code EC;
719- llvm::raw_fd_ostream OS (Path, EC, llvm::sys::fs::F_None);
720- if (EC) {
721- Instance.getDiags ().diagnose (SourceLoc (), diag::error_opening_output, Path,
722- EC.message ());
723- return true ;
724- }
725- OS << " // Automatically generated C source file from the Swift compiler \n "
726- << " // to add removed symbols back to the high-level framework for deployment\n "
727- << " // targets prior to the OS version when these symbols were moved to\n "
728- << " // a low-level framework " << module ->getName ().str () << " .\n\n " ;
729- unsigned Idx = 0 ;
730- for (auto &S: ldSymbols) {
731- SmallString<32 > NameBuffer;
732- llvm::raw_svector_ostream NameOS (NameBuffer);
733- NameOS << " ldAdd_" << Idx;
734- OS << " extern const char " << NameOS.str () << " __asm(\" " <<
735- changeToLdAdd (S) << " \" );\n " ;
736- OS << " const char " << NameOS.str () << " = 0;\n " ;
737- ++ Idx;
738- }
739- return false ;
740- }
741-
742685static bool performCompileStepsPostSILGen (CompilerInstance &Instance,
743686 std::unique_ptr<SILModule> SM,
744687 ModuleOrSourceFile MSF,
@@ -882,9 +825,6 @@ static bool emitAnyWholeModulePostTypeCheckSupplementaryOutputs(
882825 {
883826 hadAnyError |= writeTBDIfNeeded (Instance);
884827 }
885- {
886- hadAnyError |= writeLdAddCFileIfNeeded (Instance);
887- }
888828
889829 return hadAnyError;
890830}
0 commit comments