summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2016-07-14 02:24:01 +0000
committerLang Hames <lhames@gmail.com>2016-07-14 02:24:01 +0000
commitfc209623e976118cf016c0d3c1dccacb6bfa27c1 (patch)
tree407a60990972f87acb6c6aed9c218ac6ab4b203a /llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
parentaf7e8465e1fabdfff6c3a08a14cdb83ed79a10dc (diff)
downloadbcm5719-llvm-fc209623e976118cf016c0d3c1dccacb6bfa27c1.tar.gz
bcm5719-llvm-fc209623e976118cf016c0d3c1dccacb6bfa27c1.zip
[Object] Re-apply r275316 now that I have the corresponding LLD patch ready.
llvm-svn: 275361
Diffstat (limited to 'llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp')
-rw-r--r--llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
index 0c408ccb5ba..c92d20d6ccf 100644
--- a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
+++ b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
@@ -50,6 +50,14 @@ static void error(std::error_code EC) {
exit(1);
}
+static void error(Error Err) {
+ if (Err) {
+ logAllUnhandledErrors(std::move(Err), outs(), "Error reading file: ");
+ outs().flush();
+ exit(1);
+ }
+}
+
} // namespace llvm
static void reportError(StringRef Input, StringRef Message) {
@@ -482,9 +490,8 @@ static void dumpCXXData(const ObjectFile *Obj) {
}
static void dumpArchive(const Archive *Arc) {
- for (auto &ErrorOrChild : Arc->children()) {
- error(ErrorOrChild.getError());
- const Archive::Child &ArcC = *ErrorOrChild;
+ Error Err;
+ for (auto &ArcC : Arc->children(Err)) {
Expected<std::unique_ptr<Binary>> ChildOrErr = ArcC.getAsBinary();
if (!ChildOrErr) {
// Ignore non-object files.
@@ -504,6 +511,7 @@ static void dumpArchive(const Archive *Arc) {
else
reportError(Arc->getFileName(), cxxdump_error::unrecognized_file_format);
}
+ error(std::move(Err));
}
static void dumpInput(StringRef File) {
OpenPOWER on IntegriCloud