/// @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)