[llvm] r350851 - [llvm-objdump][MachO] Fix error reporting after r350848 and r350849

Francis Visoiu Mistrih via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 10 09:36:55 PST 2019


Author: thegameg
Date: Thu Jan 10 09:36:54 2019
New Revision: 350851

URL: http://llvm.org/viewvc/llvm-project?rev=350851&view=rev
Log:
[llvm-objdump][MachO] Fix error reporting after r350848 and r350849

Modified:
    llvm/trunk/test/tools/llvm-objdump/invalid-input.test
    llvm/trunk/tools/llvm-objdump/MachODump.cpp

Modified: llvm/trunk/test/tools/llvm-objdump/invalid-input.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/invalid-input.test?rev=350851&r1=350850&r2=350851&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/invalid-input.test (original)
+++ llvm/trunk/test/tools/llvm-objdump/invalid-input.test Thu Jan 10 09:36:54 2019
@@ -9,8 +9,7 @@ RUN: not llvm-objdump -macho -disassembl
 UNKNOWN_FILE_TYPE_DSYM: {{.*}}llvm-objdump: error:
 
 RUN: not llvm-objdump -macho -disassemble -g -dsym=%p/missing-dsym %p/Inputs/bind.macho-x86_64 2>&1 | FileCheck %s -check-prefix=NO_SUCH_FILE_DSYM
-NO_SUCH_FILE_DSYM: error: {{.*}}missing-dsym:
+NO_SUCH_FILE_DSYM: error: '{{.*}}missing-dsym':
 
 RUN: not llvm-objdump -macho -disassemble -g -dsym=%s %p/Inputs/bind.macho-x86_64 2>&1 | FileCheck %s -check-prefix=UNKNOWN_FILE_TYPE_DSYM_MSG
-UNKNOWN_FILE_TYPE_DSYM_MSG: {{.*}}llvm-objdump: error:
-UNKNOWN_FILE_TYPE_DSYM_MSG-NOT: bind.macho-x86_64
+UNKNOWN_FILE_TYPE_DSYM_MSG: error: '{{.*}}.test'

Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=350851&r1=350850&r2=350851&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Thu Jan 10 09:36:54 2019
@@ -6970,15 +6970,17 @@ static void DisassembleMachO(StringRef F
       ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
           MemoryBuffer::getFileOrSTDIN(DSYMFile);
       if (std::error_code EC = BufOrErr.getError()) {
-        WithColor::error(errs(), "llvm-objdump")
-            << DSYMFile << ": " << EC.message() << '\n';
+        report_error(DSYMFile, errorCodeToError(EC));
         return;
       }
+
       Expected<std::unique_ptr<MachOObjectFile>> DbgObjCheck =
           ObjectFile::createMachOObjectFile(BufOrErr.get()->getMemBufferRef());
 
-      if (Error E = DbgObjCheck.takeError())
+      if (Error E = DbgObjCheck.takeError()) {
         report_error(DSYMFile, std::move(E));
+        return;
+      }
 
       DbgObj = DbgObjCheck.get().release();
       // We need to keep the file alive, because we're replacing DbgObj with it.




More information about the llvm-commits mailing list