@@ -160,25 +160,6 @@ parseBatchScanInputFile(ASTContext &ctx, StringRef batchInputPath,
160160 return result;
161161}
162162
163- static void removeMacroSearchPaths (std::vector<std::string> &cmd) {
164- // Macro search path options.
165- static const llvm::StringSet<> macroSearchOptions = {
166- " -plugin-path" ,
167- " -external-plugin-path" ,
168- " -load-plugin-library" ,
169- " -load-plugin-executable" ,
170- " -in-process-plugin-server-path" ,
171- };
172-
173- // Remove macro search path option and its argument.
174- for (auto it = cmd.begin (); it != cmd.end ();) {
175- if (macroSearchOptions.contains (*it) && it + 1 != cmd.end ())
176- it = cmd.erase (it, it + 2 );
177- else
178- ++it;
179- }
180- }
181-
182163class ExplicitModuleDependencyResolver {
183164public:
184165 ExplicitModuleDependencyResolver (
@@ -302,6 +283,13 @@ class ExplicitModuleDependencyResolver {
302283 depInfo.addMacroDependency (
303284 macro.first (), macro.second .LibraryPath , macro.second .ExecutablePath );
304285
286+ for (auto ¯o : depInfo.getMacroDependencies ()) {
287+ std::string arg = macro.second .LibraryPath + " #" +
288+ macro.second .ExecutablePath + " #" + macro.first ;
289+ commandline.push_back (" -load-resolved-plugin" );
290+ commandline.push_back (arg);
291+ }
292+
305293 // Update CAS dependencies.
306294 if (auto err = collectCASDependencies (depInfo))
307295 return err;
@@ -529,11 +517,6 @@ class ExplicitModuleDependencyResolver {
529517 // Update build command line.
530518 if (resolvingDepInfo.isSwiftInterfaceModule () ||
531519 resolvingDepInfo.isSwiftSourceModule ()) {
532- // If there are no external macro dependencies, drop all plugin search
533- // paths.
534- if (resolvingDepInfo.getMacroDependencies ().empty () && macros.empty ())
535- removeMacroSearchPaths (commandline);
536-
537520 // Update with casfs option.
538521 for (auto rootID : rootIDs) {
539522 commandline.push_back (" -cas-fs" );
0 commit comments