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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214379 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-07-31 03:36:00 +00:00
parent 79002da926
commit 1c9b9823da
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;