From bf26d54047fde7a750e41f0707ace9ba2517322a Mon Sep 17 00:00:00 2001 From: Gerolf Hoflehner Date: Thu, 19 Apr 2018 20:48:35 +0000 Subject: [PATCH] [llvm-objdump] Issue error message when object file cannot be created llvm-svn: 330364 --- llvm/tools/llvm-objdump/MachODump.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp index 42df15d..fe2897b 100644 --- a/llvm/tools/llvm-objdump/MachODump.cpp +++ b/llvm/tools/llvm-objdump/MachODump.cpp @@ -6945,10 +6945,12 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF, errs() << "llvm-objdump: " << Filename << ": " << EC.message() << '\n'; return; } - DbgObj = - ObjectFile::createMachOObjectFile(BufOrErr.get()->getMemBufferRef()) - .get() - .release(); + Expected> DbgObjCheck = + ObjectFile::createMachOObjectFile(BufOrErr.get()->getMemBufferRef()); + + if (DbgObjCheck.takeError()) + report_error(MachOOF->getFileName(), DbgObjCheck.takeError()); + DbgObj = DbgObjCheck.get().release(); } // Setup the DIContext -- 2.7.4