Skip to content

[swift-ide-test] Add plugin related options #65075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions tools/swift-ide-test/swift-ide-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,22 @@ ImportObjCHeader("import-objc-header",
llvm::cl::desc("header to implicitly import"),
llvm::cl::cat(Category));

static llvm::cl::list<std::string>
PluginPath("plugin-path",
llvm::cl::desc("plugin-path"),
llvm::cl::cat(Category));

static llvm::cl::list<std::string>
LoadPluginLibrary("load-plugin-library",
llvm::cl::desc("load plugin library"),
llvm::cl::cat(Category));

static llvm::cl::list<std::string>
LoadPluginExecutable("load-plugin-executable",
llvm::cl::desc("load plugin executable"),
llvm::cl::cat(Category));


static llvm::cl::opt<bool>
EnableSourceImport("enable-source-import", llvm::cl::Hidden,
llvm::cl::cat(Category), llvm::cl::init(false));
Expand Down Expand Up @@ -4473,6 +4489,33 @@ int main(int argc, char *argv[]) {
}
}

for (auto path : options::PluginPath) {
InitInvok.getSearchPathOptions().PluginSearchPaths.push_back(path);
}
if (!options::LoadPluginLibrary.empty()) {
std::vector<std::string> paths;
for (auto path: options::LoadPluginLibrary) {
llvm::errs() << "LoadPluginLibrary: " << path << "\n";
paths.push_back(path);
}
InitInvok.getSearchPathOptions().setCompilerPluginLibraryPaths(paths);
}
if (!options::LoadPluginExecutable.empty()) {
std::vector<PluginExecutablePathAndModuleNames> pairs;
for (auto arg: options::LoadPluginExecutable) {
StringRef path;
StringRef modulesStr;
std::tie(path, modulesStr) = StringRef(arg).rsplit('#');
std::vector<std::string> moduleNames;
for (auto name : llvm::split(modulesStr, ',')) {
moduleNames.emplace_back(name);
}
pairs.push_back({std::string(path), std::move(moduleNames)});
}

InitInvok.getSearchPathOptions().setCompilerPluginExecutablePaths(std::move(pairs));
}

// Process the clang arguments last and allow them to override previously
// set options.
if (!CCArgs.empty()) {
Expand Down