[PATCH] D13093: [ELF2] - output of all unknown arguments instead of only one
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 02:46:13 PDT 2015
grimar updated this revision to Diff 35597.
grimar added a comment.
- Review comment addressed.
- Fixed code format in Error.cpp
http://reviews.llvm.org/D13093
Files:
DriverUtils.cpp
Error.cpp
Error.h
Index: Error.h
===================================================================
--- Error.h
+++ Error.h
@@ -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);
Index: Error.cpp
===================================================================
--- Error.cpp
+++ Error.cpp
@@ -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);
Index: DriverUtils.cpp
===================================================================
--- DriverUtils.cpp
+++ DriverUtils.cpp
@@ -58,7 +58,12 @@
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(Twine("warning: unknown argument: ") + Arg->getSpelling());
+ if (Unknowns.begin() != Unknowns.end())
+ error(Twine("unknown argument(s) found"));
+
return Args;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13093.35597.patch
Type: text/x-patch
Size: 1430 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150924/4f8622d2/attachment.bin>
More information about the llvm-commits
mailing list