1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

A std::unique_ptr case I missed in the previous patch.

llvm-svn: 214379
This commit is contained in:
Rafael Espindola 2014-07-31 03:36:00 +00:00
parent 191faa331e
commit c2dc7844eb
3 changed files with 8 additions and 5 deletions

View File

@ -165,7 +165,8 @@ public:
};
Archive(std::unique_ptr<MemoryBuffer> Source, std::error_code &EC);
static ErrorOr<Archive *> create(std::unique_ptr<MemoryBuffer> Source);
static ErrorOr<std::unique_ptr<Archive>>
create(std::unique_ptr<MemoryBuffer> Source);
enum Kind {
K_GNU,

View File

@ -184,12 +184,13 @@ Archive::Child::getAsBinary(LLVMContext *Context) const {
return createBinary(std::move(*BuffOrErr), Context);
}
ErrorOr<Archive *> Archive::create(std::unique_ptr<MemoryBuffer> Source) {
ErrorOr<std::unique_ptr<Archive>>
Archive::create(std::unique_ptr<MemoryBuffer> Source) {
std::error_code EC;
std::unique_ptr<Archive> Ret(new Archive(std::move(Source), EC));
if (EC)
return EC;
return Ret.release();
return std::move(Ret);
}
Archive::Archive(std::unique_ptr<MemoryBuffer> Source, std::error_code &ec)

View File

@ -88,10 +88,11 @@ std::error_code MachOUniversalBinary::ObjectForArch::getAsArchive(
std::string ObjectName = Parent->getFileName().str();
std::unique_ptr<MemoryBuffer> ObjBuffer(
MemoryBuffer::getMemBuffer(ObjectData, ObjectName, false));
ErrorOr<Archive *> Obj = Archive::create(std::move(ObjBuffer));
ErrorOr<std::unique_ptr<Archive>> Obj =
Archive::create(std::move(ObjBuffer));
if (std::error_code EC = Obj.getError())
return EC;
Result.reset(Obj.get());
Result = std::move(Obj.get());
return object_error::success;
}
return object_error::parse_failed;