@@ -376,6 +376,32 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
376
376
inputArgs.AddAllArgs (arguments, options::OPT_file_compilation_dir);
377
377
}
378
378
379
+ // Add plugin path options.
380
+ inputArgs.AddAllArgs (arguments, options::OPT_plugin_path);
381
+
382
+ {
383
+ SmallString<64 > pluginPath;
384
+ auto programPath = getDriver ().getSwiftProgramPath ();
385
+ CompilerInvocation::computeRuntimeResourcePathFromExecutablePath (
386
+ programPath, /* shared=*/ true , pluginPath);
387
+
388
+ auto defaultPluginPath = pluginPath;
389
+ llvm::sys::path::append (defaultPluginPath, " host" , " plugins" );
390
+
391
+ // Default plugin path.
392
+ arguments.push_back (" -plugin-path" );
393
+ arguments.push_back (inputArgs.MakeArgString (defaultPluginPath));
394
+
395
+ // Local plugin path.
396
+ llvm::sys::path::remove_filename (pluginPath); // Remove "swift"
397
+ llvm::sys::path::remove_filename (pluginPath); // Remove "lib"
398
+ llvm::sys::path::append (pluginPath, " local" , " lib" );
399
+ llvm::sys::path::append (pluginPath, " swift" );
400
+ llvm::sys::path::append (pluginPath, " host" , " plugins" );
401
+ arguments.push_back (" -plugin-path" );
402
+ arguments.push_back (inputArgs.MakeArgString (pluginPath));
403
+ }
404
+
379
405
// Pass through any subsystem flags.
380
406
inputArgs.AddAllArgs (arguments, options::OPT_Xllvm);
381
407
inputArgs.AddAllArgs (arguments, options::OPT_Xcc);
0 commit comments