From 1051909df1a2dfc9e3b4b27d15b36b3019c21463 Mon Sep 17 00:00:00 2001 From: Kevin Enderby Date: Mon, 27 Jun 2016 21:39:39 +0000 Subject: Change all but the last ErrorOr<...> use for MachOUniversalBinary to Expected<...> to allow a good error message to be produced. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I added the one test case that the object file tools could produce an error message. The other two errors can’t be triggered if the input file is passed through sys::fs::identify_magic(). But the malformedError("bad magic number") does get triggered by the logic in llvm-dsymutil when dealing with a normal Mach-O file. The other "File too small ..." error would take a logic error currently to produce and is not tested for. llvm-svn: 273946 --- llvm/lib/Object/Binary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Object/Binary.cpp') diff --git a/llvm/lib/Object/Binary.cpp b/llvm/lib/Object/Binary.cpp index 723b279d9e6..8d03a2a976b 100644 --- a/llvm/lib/Object/Binary.cpp +++ b/llvm/lib/Object/Binary.cpp @@ -65,7 +65,7 @@ Expected> object::createBinary(MemoryBufferRef Buffer, case sys::fs::file_magic::bitcode: return ObjectFile::createSymbolicFile(Buffer, Type, Context); case sys::fs::file_magic::macho_universal_binary: - return errorOrToExpected(MachOUniversalBinary::create(Buffer)); + return MachOUniversalBinary::create(Buffer); case sys::fs::file_magic::unknown: case sys::fs::file_magic::windows_resource: // Unrecognized object file format. -- cgit v1.2.3