[PATCH] D41127: Use the standard error handling mechanism in MinGW driver.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 12 12:35:23 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL320526: Use the standard error handling mechanism in MinGW driver. (authored by ruiu, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D41127?vs=126602&id=126606#toc
Repository:
rL LLVM
https://reviews.llvm.org/D41127
Files:
lld/trunk/MinGW/Driver.cpp
Index: lld/trunk/MinGW/Driver.cpp
===================================================================
--- lld/trunk/MinGW/Driver.cpp
+++ lld/trunk/MinGW/Driver.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "lld/Common/Driver.h"
+#include "lld/Common/ErrorHandler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringExtras.h"
@@ -30,11 +31,6 @@
using namespace lld;
using namespace llvm;
-LLVM_ATTRIBUTE_NORETURN static void error(const Twine &Msg) {
- errs() << Msg << "\n";
- exit(1);
-}
-
// Create OptTable
enum {
OPT_INVALID = 0,
@@ -73,11 +69,11 @@
opt::InputArgList Args = this->ParseArgs(Vec, MissingIndex, MissingCount);
if (MissingCount)
- error(StringRef(Args.getArgString(MissingIndex)) + ": missing argument");
+ fatal(StringRef(Args.getArgString(MissingIndex)) + ": missing argument");
for (auto *Arg : Args.filtered(OPT_UNKNOWN))
- error("unknown argument: " + Arg->getSpelling());
+ fatal("unknown argument: " + Arg->getSpelling());
if (!Args.hasArg(OPT_INPUT) && !Args.hasArg(OPT_l))
- error("no input files");
+ fatal("no input files");
return Args;
}
@@ -97,7 +93,7 @@
for (StringRef Dir : SearchPaths)
if (Optional<std::string> S = findFile(Dir, Name.substr(1)))
return *S;
- error("unable to find library -l" + Name);
+ fatal("unable to find library -l" + Name);
}
for (StringRef Dir : SearchPaths) {
@@ -107,7 +103,7 @@
if (Optional<std::string> S = findFile(Dir, "lib" + Name + ".a"))
return *S;
}
- error("unable to find library -l" + Name);
+ fatal("unable to find library -l" + Name);
}
// Convert Unix-ish command line arguments to Windows-ish ones and
@@ -175,7 +171,7 @@
else if (S == "safe" || S == "none")
Add("-opt:noicf");
else
- error("unknown parameter: --icf=" + S);
+ fatal("unknown parameter: --icf=" + S);
} else {
Add("-opt:noicf");
}
@@ -191,7 +187,7 @@
else if (S == "arm64pe")
Add("-machine:arm64");
else
- error("unknown parameter: -m" + S);
+ fatal("unknown parameter: -m" + S);
}
for (auto *A : Args.filtered(OPT_mllvm))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41127.126606.patch
Type: text/x-patch
Size: 2255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171212/b613aa49/attachment.bin>
More information about the llvm-commits
mailing list