mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[llvm-objdump] Use report_error() and improve error coverage.
llvm-svn: 257561
This commit is contained in:
parent
ec88d2d728
commit
baadd9459c
BIN
test/tools/llvm-objdump/Inputs/malformed-macho.bin
Normal file
BIN
test/tools/llvm-objdump/Inputs/malformed-macho.bin
Normal file
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
// These test checks that llvm-objdump will not crash with malformed Archive
|
||||
// files. So the check line is not all that important but the bug fixes to
|
||||
// make sure llvm-objdump is robust is what matters.
|
||||
# RUN: llvm-objdump -macho -archive-headers \
|
||||
# RUN: not llvm-objdump -macho -archive-headers \
|
||||
# RUN: %p/Inputs/libbogus1.a \
|
||||
# RUN: 2>&1 | FileCheck -check-prefix=bogus1 %s
|
||||
|
||||
|
2
test/tools/llvm-objdump/malformed-macho.test
Normal file
2
test/tools/llvm-objdump/malformed-macho.test
Normal file
@ -0,0 +1,2 @@
|
||||
RUN: not llvm-objdump -macho -s %p/Inputs/malformed-macho.bin 2>&1 | FileCheck %s -check-prefix=MALFORMED
|
||||
MALFORMED: '{{.*}}': The file was not recognized as a valid object file
|
@ -1481,10 +1481,8 @@ void llvm::ParseInputMachO(StringRef Filename) {
|
||||
|
||||
// Attempt to open the binary.
|
||||
ErrorOr<OwningBinary<Binary>> BinaryOrErr = createBinary(Filename);
|
||||
if (std::error_code EC = BinaryOrErr.getError()) {
|
||||
errs() << "llvm-objdump: '" << Filename << "': " << EC.message() << ".\n";
|
||||
return;
|
||||
}
|
||||
if (std::error_code EC = BinaryOrErr.getError())
|
||||
report_error(Filename, EC);
|
||||
Binary &Bin = *BinaryOrErr.get().getBinary();
|
||||
|
||||
if (Archive *A = dyn_cast<Archive>(&Bin)) {
|
||||
|
Loading…
Reference in New Issue
Block a user