ltoDebugPM = true;
} else if (s == "noltodebugpassmanager") {
ltoDebugPM = false;
- } else if (s.startswith("lldlto=")) {
- StringRef optLevel = s.substr(7);
- if (optLevel.getAsInteger(10, config->ltoo) || config->ltoo > 3)
- error("/opt:lldlto: invalid optimization level: " + optLevel);
- } else if (s.startswith("lldltojobs=")) {
- StringRef jobs = s.substr(11);
- if (!get_threadpool_strategy(jobs))
- error("/opt:lldltojobs: invalid job count: " + jobs);
- config->thinLTOJobs = jobs.str();
- } else if (s.startswith("lldltopartitions=")) {
- StringRef n = s.substr(17);
- if (n.getAsInteger(10, config->ltoPartitions) ||
+ } else if (s.consume_front("lldlto=")) {
+ if (s.getAsInteger(10, config->ltoo) || config->ltoo > 3)
+ error("/opt:lldlto: invalid optimization level: " + s);
+ } else if (s.consume_front("lldltojobs=")) {
+ if (!get_threadpool_strategy(s))
+ error("/opt:lldltojobs: invalid job count: " + s);
+ config->thinLTOJobs = s.str();
+ } else if (s.consume_front("lldltopartitions=")) {
+ if (s.getAsInteger(10, config->ltoPartitions) ||
config->ltoPartitions == 0)
- error("/opt:lldltopartitions: invalid partition count: " + n);
+ error("/opt:lldltopartitions: invalid partition count: " + s);
} else if (s != "lbr" && s != "nolbr")
error("/opt: unknown option: " + s);
}