2121#include " swift/Driver/Compilation.h"
2222#include " swift/Driver/Driver.h"
2323#include " swift/Driver/Job.h"
24+ #include " swift/IDETool/CompilerInvocation.h"
2425#include " swift/Option/Options.h"
2526#include " swift/Option/SanitizerOptions.h"
2627#include " clang/Basic/Version.h"
@@ -47,6 +48,31 @@ toolchains::GenericUnix::sanitizerRuntimeLibName(StringRef Sanitizer,
4748 .str ();
4849}
4950
51+ void
52+ toolchains::GenericUnix::addPluginArguments (const ArgList &Args,
53+ ArgStringList &Arguments) const {
54+ SmallString<64 > pluginPath;
55+ auto programPath = getDriver ().getSwiftProgramPath ();
56+ CompilerInvocation::computeRuntimeResourcePathFromExecutablePath (
57+ programPath, /* shared=*/ true , pluginPath);
58+
59+ auto defaultPluginPath = pluginPath;
60+ llvm::sys::path::append (defaultPluginPath, " host" , " plugins" );
61+
62+ // Default plugin path.
63+ Arguments.push_back (" -plugin-path" );
64+ Arguments.push_back (Args.MakeArgString (defaultPluginPath));
65+
66+ // Local plugin path.
67+ llvm::sys::path::remove_filename (pluginPath); // Remove "swift"
68+ llvm::sys::path::remove_filename (pluginPath); // Remove "lib"
69+ llvm::sys::path::append (pluginPath, " local" , " lib" );
70+ llvm::sys::path::append (pluginPath, " swift" );
71+ llvm::sys::path::append (pluginPath, " host" , " plugins" );
72+ Arguments.push_back (" -plugin-path" );
73+ Arguments.push_back (Args.MakeArgString (pluginPath));
74+ }
75+
5076ToolChain::InvocationInfo
5177toolchains::GenericUnix::constructInvocation (const InterpretJobAction &job,
5278 const JobContext &context) const {
0 commit comments