unique_ptrify MachOUniversalBinary::create

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217052 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2014-09-03 17:41:05 +00:00
parent b89304eb7c
commit 413eadfac9
3 changed files with 5 additions and 5 deletions

View File

@ -85,7 +85,8 @@ public:
};
MachOUniversalBinary(MemoryBufferRef Souce, std::error_code &EC);
static ErrorOr<MachOUniversalBinary *> create(MemoryBufferRef Source);
static ErrorOr<std::unique_ptr<MachOUniversalBinary>>
create(MemoryBufferRef Source);
object_iterator begin_objects() const {
return ObjectForArch(this, 0);

View File

@ -63,8 +63,7 @@ ErrorOr<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 ErrorOr<std::unique_ptr<Binary>>(
MachOUniversalBinary::create(Buffer));
return MachOUniversalBinary::create(Buffer);
case sys::fs::file_magic::unknown:
case sys::fs::file_magic::windows_resource:
// Unrecognized object file format.

View File

@ -97,14 +97,14 @@ std::error_code MachOUniversalBinary::ObjectForArch::getAsArchive(
void MachOUniversalBinary::anchor() { }
ErrorOr<MachOUniversalBinary *>
ErrorOr<std::unique_ptr<MachOUniversalBinary>>
MachOUniversalBinary::create(MemoryBufferRef Source) {
std::error_code EC;
std::unique_ptr<MachOUniversalBinary> Ret(
new MachOUniversalBinary(Source, EC));
if (EC)
return EC;
return Ret.release();
return std::move(Ret);
}
MachOUniversalBinary::MachOUniversalBinary(MemoryBufferRef Source,