llvm-objdump: Ignore non-objects in archives.
authorMichael J. Spencer <bigcheesegs@gmail.com>
Wed, 16 Nov 2011 01:24:41 +0000 (01:24 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Wed, 16 Nov 2011 01:24:41 +0000 (01:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144755 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-objdump/llvm-objdump.cpp

index d7c549299513248ec19e4e749c0431cc79eac3b7..9071d58b0e7e27a68883ae8249bdc924a3399a16 100644 (file)
@@ -556,8 +556,10 @@ static void DumpArchive(const Archive *a) {
                                e = a->end_children(); i != e; ++i) {
     OwningPtr<Binary> child;
     if (error_code ec = i->getAsBinary(child)) {
-      errs() << ToolName << ": '" << a->getFileName() << "': " << ec.message()
-             << ".\n";
+      // Ignore non-object files.
+      if (ec != object_error::invalid_file_type)
+        errs() << ToolName << ": '" << a->getFileName() << "': " << ec.message()
+               << ".\n";
       continue;
     }
     if (ObjectFile *o = dyn_cast<ObjectFile>(child.get()))