aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2016-10-21 20:03:14 +0000
committerKevin Enderby <enderby@apple.com>2016-10-21 20:03:14 +0000
commita9abde40d7e410e273dbfa4e1981e8e521b2d3fd (patch)
treec8d88ad4537d42ccbb37e7540e6a843d8c6c7ead
parentaa9584aa789c152670ce84ee881625c13bb8871a (diff)
Fix a bug in the code of llvm-cxxdump in dumpArchive() when
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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284867 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/tools/llvm-cxxdump/Inputs/mixed-archive.coff-i386bin0 -> 3230 bytes
-rw-r--r--test/tools/llvm-cxxdump/trivial.test5
-rw-r--r--tools/llvm-cxxdump/llvm-cxxdump.cpp2
3 files changed, 6 insertions, 1 deletions
diff --git a/test/tools/llvm-cxxdump/Inputs/mixed-archive.coff-i386 b/test/tools/llvm-cxxdump/Inputs/mixed-archive.coff-i386
new file mode 100644
index 00000000000..d8a77ef10ab
--- /dev/null
+++ b/test/tools/llvm-cxxdump/Inputs/mixed-archive.coff-i386
Binary files differ
diff --git a/test/tools/llvm-cxxdump/trivial.test b/test/tools/llvm-cxxdump/trivial.test
index 2c36620bff2..d4982b87d8d 100644
--- a/test/tools/llvm-cxxdump/trivial.test
+++ b/test/tools/llvm-cxxdump/trivial.test
@@ -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
diff --git a/tools/llvm-cxxdump/llvm-cxxdump.cpp b/tools/llvm-cxxdump/llvm-cxxdump.cpp
index c92d20d6ccf..518d414c7b9 100644
--- a/tools/llvm-cxxdump/llvm-cxxdump.cpp
+++ b/tools/llvm-cxxdump/llvm-cxxdump.cpp
@@ -502,7 +502,7 @@ static void dumpArchive(const Archive *Arc) {
OS.flush();
reportError(Arc->getFileName(), Buf);
}
- ChildOrErr.takeError();
+ consumeError(ChildOrErr.takeError());
continue;
}