Fix a bug in the code of llvm-cxxdump in dumpArchive() when
authorKevin Enderby <enderby@apple.com>
Fri, 21 Oct 2016 20:03:14 +0000 (20:03 +0000)
committerKevin Enderby <enderby@apple.com>
Fri, 21 Oct 2016 20:03:14 +0000 (20:03 +0000)
iterating over an archive with object and non-object members that
would cause an Abort because to was not calling consumeError()
when the code was wanting to ignore a non-object file.

Found by Justin Bogner!

llvm-svn: 284867

llvm/test/tools/llvm-cxxdump/Inputs/mixed-archive.coff-i386 [new file with mode: 0644]
llvm/test/tools/llvm-cxxdump/trivial.test
llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp

diff --git a/llvm/test/tools/llvm-cxxdump/Inputs/mixed-archive.coff-i386 b/llvm/test/tools/llvm-cxxdump/Inputs/mixed-archive.coff-i386
new file mode 100644 (file)
index 0000000..d8a77ef
Binary files /dev/null and b/llvm/test/tools/llvm-cxxdump/Inputs/mixed-archive.coff-i386 differ
index 2c36620..d4982b8 100644 (file)
@@ -4,6 +4,9 @@ RUN:   | FileCheck %s --check-prefix=COFF-I386
 RUN: llvm-cxxdump %p/Inputs/trivial.obj.elf-i386 \
 RUN:   | FileCheck %s --check-prefix=ELF-I386
 
+RUN: llvm-cxxdump %p/Inputs/mixed-archive.coff-i386 \
+RUN:   | FileCheck %s --check-prefix=MIXEDARCOFF-I386
+
 COFF-I386:      ??_7S@@6B@[0]: ??_R4S@@6B@
 COFF-I386-NEXT: ??_7S@@6B@[4]: ??_GS@@UAEPAXI@Z
 COFF-I386-NEXT: ??_8S@@7B@[0]: -4
@@ -57,5 +60,7 @@ ELF-I386-NEXT: _ZTV1A[0]: 0
 ELF-I386-NEXT: _ZTV1A[4]: _ZTI1A
 ELF-I386-NEXT: _ZTV1A[8]: _ZN1A1fEv
 
+MIXEDARCOFF-I386:      ??_7S@@6B@[0]: ??_R4S@@6B@
+
 RUN: not llvm-cxxdump %t.blah 2>&1 | FileCheck --check-prefix=ENOENT %s
 ENOENT: {{.*}}.blah: {{[Nn]}}o such file or directory
index c92d20d..518d414 100644 (file)
@@ -502,7 +502,7 @@ static void dumpArchive(const Archive *Arc) {
         OS.flush();
         reportError(Arc->getFileName(), Buf);
       }
-      ChildOrErr.takeError();
+      consumeError(ChildOrErr.takeError());
       continue;
     }