1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

unique_ptrify MachOUniversalBinary::create

llvm-svn: 217052
This commit is contained in:
David Blaikie 2014-09-03 17:41:05 +00:00
parent fbe1366788
commit a84a0ee1dc
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,