[PATCH] D13093: [ELF2] - output of all unknown arguments instead of only one

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 06:49:56 PDT 2015


grimar updated this revision to Diff 35490.
grimar added a comment.

Agree. Returned range loop.


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,10 @@
 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());
+
+  auto 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.35490.patch
Type: text/x-patch
Size: 1408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150923/7982bbaf/attachment.bin>


More information about the llvm-commits mailing list