Merge pull request #76732 from cachemeifyoucan/eng/PR-136682810

[Macro] Precise macro plugin dependency during scanning
This commit is contained in:
Steven Wu
2024-11-04 09:21:33 -08:00
committed by GitHub
13 changed files with 117 additions and 64 deletions

View File

@@ -2172,6 +2172,27 @@ static bool ParseSearchPathArgs(SearchPathOptions &Opts, ArgList &Args,
resolveSearchPath(dylibPath), resolveSearchPath(serverPath)});
break;
}
case OPT_load_resolved_plugin: {
StringRef libraryPath;
StringRef executablePath;
StringRef modulesStr;
std::tie(libraryPath, executablePath) =
StringRef(A->getValue()).split('#');
std::tie(executablePath, modulesStr) = executablePath.split('#');
if (modulesStr.empty() ||
(libraryPath.empty() && executablePath.empty())) {
Diags.diagnose(SourceLoc(), diag::error_load_resolved_plugin,
A->getValue());
}
std::vector<std::string> moduleNames;
for (auto name : llvm::split(modulesStr, ',')) {
moduleNames.emplace_back(name);
}
Opts.PluginSearchOpts.emplace_back(
PluginSearchOption::ResolvedPluginConfig{
libraryPath.str(), executablePath.str(), std::move(moduleNames)});
break;
}
default:
llvm_unreachable("unhandled plugin search option");
}