I suggest to report all unknown arguments before exit(1), that is helpful for debugging.
Diff Detail
Event Timeline
- for (auto *Arg : Args.filtered(OPT_UNKNOWN))
- error(Twine("unknown argument: ") + Arg->getSpelling());
+
+ auto unknowns = Args.filtered(OPT_UNKNOWN);
+ for (llvm::opt::arg_iterator Arg = unknowns.begin(), End = unknowns.end(); Arg != End; ++Arg)
+ warning(Twine("warning: unknown argument: ") + (*Arg)->getSpelling());
+ if (unknowns.begin() != unknowns.end())
+ error(Twine("unknown argument(s) found"));
+
You should still be able to use a range loop:
auto Unknowns = Args.filtered(OPT_UNKNOWN);
for (auto *Arg : Unknows)
....
if (Unkonws.begin() != Unknows.end())
...
DriverUtils.cpp | ||
---|---|---|
62 | Variables should start with an upper case letter. |
LGTM with this fix.
DriverUtils.cpp | ||
---|---|---|
62 | Can you write the real type of Unknowns instead of auto? |
Could you please commit this if it is fine now. I dont have permissions for that yet.
DriverUtils.cpp | ||
---|---|---|
62 | Done. |
LGTM
DriverUtils.cpp | ||
---|---|---|
66 | This Twine() is not needed because error() is overloaded both for StringRef and Twine. I'll make that change and submit. |
Variables should start with an upper case letter.