summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/Archive.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-06-23 22:00:37 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-06-23 22:00:37 +0000
commit6304e941082cc97240856ff602f4ae0dfcc08230 (patch)
treeb41276453a57d065caf55cb342366b79ac81b11b /llvm/lib/Object/Archive.cpp
parentaed5c966849821b5368f0e742439bae579f42da3 (diff)
downloadbcm5719-llvm-6304e941082cc97240856ff602f4ae0dfcc08230.tar.gz
bcm5719-llvm-6304e941082cc97240856ff602f4ae0dfcc08230.zip
Pass a std::unique_ptr& to the create??? methods is lib/Object.
This makes the buffer ownership on error conditions very natural. The buffer is only moved out of the argument if an object is constructed that now owns the buffer. llvm-svn: 211546
Diffstat (limited to 'llvm/lib/Object/Archive.cpp')
-rw-r--r--llvm/lib/Object/Archive.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp
index cd8924920a8..cdf987a3208 100644
--- a/llvm/lib/Object/Archive.cpp
+++ b/llvm/lib/Object/Archive.cpp
@@ -183,10 +183,7 @@ Archive::Child::getAsBinary(LLVMContext *Context) const {
return EC;
std::unique_ptr<MemoryBuffer> Buff(BuffOrErr.get().release());
- ErrorOr<std::unique_ptr<Binary>> Ret = createBinary(Buff.get(), Context);
- if (!Ret.getError())
- Buff.release();
- return Ret;
+ return createBinary(Buff, Context);
}
ErrorOr<Archive*> Archive::create(MemoryBuffer *Source) {
OpenPOWER on IntegriCloud