[Option] Add compiler option to specify executable plugins

Add a compiler option `-load-plugin-executable <path>#<module names>`.
Where '<path>' is a path to a plugin executable, '<module-name>' is a
comma-separated module names the plugin provides.

Nothing is using it at this point. Actual plugin infratructure are
introduced in follow-up commits
This commit is contained in:
Rintaro Ishizaki
2023-02-15 14:43:21 -08:00
parent 5f38f8e3da
commit bf0a62f3ce
4 changed files with 31 additions and 0 deletions

View File

@@ -1474,6 +1474,15 @@ static bool ParseSearchPathArgs(SearchPathOptions &Opts,
}
Opts.setCompilerPluginLibraryPaths(CompilerPluginLibraryPaths);
std::vector<std::string> CompilerPluginExecutablePaths(
Opts.getCompilerPluginExecutablePaths());
for (const Arg *A : Args.filtered(OPT_load_plugin_executable)) {
// NOTE: The value has '#<module names>' after the path.
// But resolveSearchPath() works as long as the value starts with a path.
CompilerPluginExecutablePaths.push_back(resolveSearchPath(A->getValue()));
}
Opts.setCompilerPluginExecutablePaths(CompilerPluginExecutablePaths);
return false;
}