diff options
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
-rw-r--r-- | llvm/tools/llvm-objdump/llvm-objdump.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp index 8414239cb50..bb171ec3fc3 100644 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -1702,8 +1702,10 @@ static void DumpObject(const ObjectFile *o, const Archive *a = nullptr) { /// @brief Dump each object file in \a a; static void DumpArchive(const Archive *a) { - Error Err; - for (auto &C : a->children(Err)) { + for (auto &ErrorOrChild : a->children()) { + if (std::error_code EC = ErrorOrChild.getError()) + report_error(a->getFileName(), EC); + const Archive::Child &C = *ErrorOrChild; Expected<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary(); if (!ChildOrErr) { if (auto E = isNotObjectErrorInvalidFileType(ChildOrErr.takeError())) @@ -1715,8 +1717,6 @@ static void DumpArchive(const Archive *a) { else report_error(a->getFileName(), object_error::invalid_file_type); } - if (Err) - report_error(a->getFileName(), std::move(Err)); } /// @brief Open file and figure out how to dump it. |