This removes the eating of the error in Archive::Child::getSize() when the characters
[oota-llvm.git] / tools / llvm-objdump / llvm-objdump.cpp
index 7292841c55a11d94e32a34c48fe155b3f8f72a6a..34401937bd801b723fe1aaca33f97c2cb8ed58c6 100644 (file)
@@ -1536,7 +1536,12 @@ static void DumpObject(const ObjectFile *o) {
 
 /// @brief Dump each object file in \a a;
 static void DumpArchive(const Archive *a) {
-  for (const Archive::Child &C : a->children()) {
+  for (auto &ErrorOrChild : a->children()) {
+    if (std::error_code EC = ErrorOrChild.getError()) {
+      report_error(a->getFileName(), EC);
+      break;
+    }
+    const Archive::Child &C = *ErrorOrChild;
     ErrorOr<std::unique_ptr<Binary>> ChildOrErr = C.getAsBinary();
     if (std::error_code EC = ChildOrErr.getError())
       if (EC != object_error::invalid_file_type)