[ELF2] Output of all unknown arguments instead of only one.

Patch from George Rimar!

llvm-svn: 248524
This commit is contained in:
Rui Ueyama 2015-09-24 18:55:33 +00:00
parent 9b788a452b
commit d5b5ab7638
3 changed files with 11 additions and 2 deletions

View File

@ -58,7 +58,12 @@ opt::InputArgList ArgParser::parse(ArrayRef<const char *> Argv) {
error(Twine("missing arg value for \"") + Args.getArgString(MissingIndex) +
"\", expected " + Twine(MissingCount) +
(MissingCount == 1 ? " argument.\n" : " arguments"));
for (auto *Arg : Args.filtered(OPT_UNKNOWN))
error(Twine("unknown argument: ") + Arg->getSpelling());
iterator_range<opt::arg_iterator> Unknowns = Args.filtered(OPT_UNKNOWN);
for (auto *Arg : Unknowns)
warning("warning: unknown argument: " + Arg->getSpelling());
if (Unknowns.begin() != Unknowns.end())
error("unknown argument(s) found");
return Args;
}

View File

@ -15,6 +15,8 @@
namespace lld {
namespace elf2 {
void warning(const Twine &Msg) { llvm::errs() << Msg << "\n"; }
void error(const Twine &Msg) {
llvm::errs() << Msg << "\n";
exit(1);

View File

@ -15,6 +15,8 @@
namespace lld {
namespace elf2 {
void warning(const Twine &Msg);
LLVM_ATTRIBUTE_NORETURN void error(const Twine &Msg);
void error(std::error_code EC, const Twine &Prefix);
void error(std::error_code EC);