Skip to content

Commit 421b2da

Browse files
committed
[swift-ide-test] Add plugin related options
1 parent 9f9e709 commit 421b2da

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tools/swift-ide-test/swift-ide-test.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,22 @@ ImportObjCHeader("import-objc-header",
332332
llvm::cl::desc("header to implicitly import"),
333333
llvm::cl::cat(Category));
334334

335+
static llvm::cl::list<std::string>
336+
PluginPath("plugin-path",
337+
llvm::cl::desc("plugin-path"),
338+
llvm::cl::cat(Category));
339+
340+
static llvm::cl::list<std::string>
341+
LoadPluginLibrary("load-plugin-library",
342+
llvm::cl::desc("load plugin library"),
343+
llvm::cl::cat(Category));
344+
345+
static llvm::cl::list<std::string>
346+
LoadPluginExecutable("load-plugin-executable",
347+
llvm::cl::desc("load plugin executable"),
348+
llvm::cl::cat(Category));
349+
350+
335351
static llvm::cl::opt<bool>
336352
EnableSourceImport("enable-source-import", llvm::cl::Hidden,
337353
llvm::cl::cat(Category), llvm::cl::init(false));
@@ -4481,6 +4497,33 @@ int main(int argc, char *argv[]) {
44814497
}
44824498
}
44834499

4500+
for (auto path : options::PluginPath) {
4501+
InitInvok.getSearchPathOptions().PluginSearchPaths.push_back(path);
4502+
}
4503+
if (!options::LoadPluginLibrary.empty()) {
4504+
std::vector<std::string> paths;
4505+
for (auto path: options::LoadPluginLibrary) {
4506+
llvm::errs() << "LoadPluginLibrary: " << path << "\n";
4507+
paths.push_back(path);
4508+
}
4509+
InitInvok.getSearchPathOptions().setCompilerPluginLibraryPaths(paths);
4510+
}
4511+
if (!options::LoadPluginExecutable.empty()) {
4512+
std::vector<PluginExecutablePathAndModuleNames> pairs;
4513+
for (auto arg: options::LoadPluginExecutable) {
4514+
StringRef path;
4515+
StringRef modulesStr;
4516+
std::tie(path, modulesStr) = StringRef(arg).rsplit('#');
4517+
std::vector<std::string> moduleNames;
4518+
for (auto name : llvm::split(modulesStr, ',')) {
4519+
moduleNames.emplace_back(name);
4520+
}
4521+
pairs.push_back({std::string(path), std::move(moduleNames)});
4522+
}
4523+
4524+
InitInvok.getSearchPathOptions().setCompilerPluginExecutablePaths(std::move(pairs));
4525+
}
4526+
44844527
// Process the clang arguments last and allow them to override previously
44854528
// set options.
44864529
if (!CCArgs.empty()) {

0 commit comments

Comments
 (0)