diff options
author | Kevin Enderby <enderby@apple.com> | 2016-06-27 21:39:39 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2016-06-27 21:39:39 +0000 |
commit | 1051909df1a2dfc9e3b4b27d15b36b3019c21463 (patch) | |
tree | b7493e3ee6c0a1804ef7066f625fc0e99d20c416 /llvm/lib/Object/Binary.cpp | |
parent | f9e348bd59c441be9417507f9752c66716d2ab41 (diff) | |
download | bcm5719-llvm-1051909df1a2dfc9e3b4b27d15b36b3019c21463.tar.gz bcm5719-llvm-1051909df1a2dfc9e3b4b27d15b36b3019c21463.zip |
Change all but the last ErrorOr<...> use for MachOUniversalBinary to Expected<...> to
allow a good error message to be produced.
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
Diffstat (limited to 'llvm/lib/Object/Binary.cpp')
-rw-r--r-- | llvm/lib/Object/Binary.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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<std::unique_ptr<Binary>> 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. |