3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-10-10 17:58:07 +00:00

bugpoint.cc: Quoting fixes

Don't strip runner/suffix quotes.
Quote script/command argument.
This commit is contained in:
Krystine Sherwin 2025-10-06 11:27:21 +13:00
parent 137a801b4a
commit 8ff55f184b
No known key found for this signature in database

View file

@ -468,13 +468,13 @@ struct BugpointPass : public Pass {
if (args[argidx] == "-script" && argidx + 1 < args.size()) { if (args[argidx] == "-script" && argidx + 1 < args.size()) {
if (!yosys_arg.empty()) if (!yosys_arg.empty())
log_cmd_error("A -script or -command option can be only provided once!\n"); log_cmd_error("A -script or -command option can be only provided once!\n");
yosys_arg = stringf("-s %s", args[++argidx]); yosys_arg = stringf("-s %s", quote(args[++argidx]));
continue; continue;
} }
if (args[argidx] == "-command" && argidx + 1 < args.size()) { if (args[argidx] == "-command" && argidx + 1 < args.size()) {
if (!yosys_arg.empty()) if (!yosys_arg.empty())
log_cmd_error("A -script or -command option can be only provided once!\n"); log_cmd_error("A -script or -command option can be only provided once!\n");
yosys_arg = stringf("-p %s", args[++argidx]); yosys_arg = stringf("-p %s", quote(args[++argidx]));
continue; continue;
} }
if (args[argidx] == "-grep" && argidx + 1 < args.size()) { if (args[argidx] == "-grep" && argidx + 1 < args.size()) {
@ -547,18 +547,10 @@ struct BugpointPass : public Pass {
} }
if (args[argidx] == "-runner" && argidx + 1 < args.size()) { if (args[argidx] == "-runner" && argidx + 1 < args.size()) {
runner = args[++argidx]; runner = args[++argidx];
if (runner.size() && runner.at(0) == '"') {
log_assert(runner.back() == '"');
runner = runner.substr(1, runner.size() - 2);
}
continue; continue;
} }
if (args[argidx] == "-suffix" && argidx + 1 < args.size()) { if (args[argidx] == "-suffix" && argidx + 1 < args.size()) {
suffix = args[++argidx]; suffix = args[++argidx];
if (suffix.size() && suffix.at(0) == '"') {
log_assert(suffix.back() == '"');
suffix = suffix.substr(1, suffix.size() - 2);
}
continue; continue;
} }
break; break;