summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/llvm-extract/llvm-extract.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2017-01-24 08:32:59 +0000
committerpatrick <patrick@openbsd.org>2017-01-24 08:32:59 +0000
commit53d771aafdbe5b919f264f53cba3788e2c4cffd2 (patch)
tree7eca39498be0ff1e3a6daf583cd9ca5886bb2636 /gnu/llvm/tools/llvm-extract/llvm-extract.cpp
parentIn preparation of compiling our kernels with -ffreestanding, explicitly map (diff)
downloadwireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.tar.xz
wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.zip
Import LLVM 4.0.0 rc1 including clang and lld to help the current
development effort on OpenBSD/arm64.
Diffstat (limited to 'gnu/llvm/tools/llvm-extract/llvm-extract.cpp')
-rw-r--r--gnu/llvm/tools/llvm-extract/llvm-extract.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/gnu/llvm/tools/llvm-extract/llvm-extract.cpp b/gnu/llvm/tools/llvm-extract/llvm-extract.cpp
index 900c461ebd8..aa1eda2f094 100644
--- a/gnu/llvm/tools/llvm-extract/llvm-extract.cpp
+++ b/gnu/llvm/tools/llvm-extract/llvm-extract.cpp
@@ -22,6 +22,7 @@
#include "llvm/IRReader/IRReader.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/PrettyStackTrace.h"
@@ -222,12 +223,10 @@ int main(int argc, char **argv) {
}
}
- auto Materialize = [&](GlobalValue &GV) {
- if (std::error_code EC = GV.materialize()) {
- errs() << argv[0] << ": error reading input: " << EC.message() << "\n";
- exit(1);
- }
- };
+ // Use *argv instead of argv[0] to work around a wrong GCC warning.
+ ExitOnError ExitOnErr(std::string(*argv) + ": error reading input: ");
+
+ auto Materialize = [&](GlobalValue &GV) { ExitOnErr(GV.materialize()); };
// Materialize requisite global values.
if (!DeleteFn) {
@@ -251,7 +250,7 @@ int main(int argc, char **argv) {
// Now that we have all the GVs we want, mark the module as fully
// materialized.
// FIXME: should the GVExtractionPass handle this?
- M->materializeAll();
+ ExitOnErr(M->materializeAll());
}
// In addition to deleting all other functions, we also want to spiff it