summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/Archive.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object/Archive.cpp')
-rw-r--r--llvm/lib/Object/Archive.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp
index 71efca2b186..f91752e0ab0 100644
--- a/llvm/lib/Object/Archive.cpp
+++ b/llvm/lib/Object/Archive.cpp
@@ -187,9 +187,10 @@ error_code Archive::Child::getAsBinary(OwningPtr<Binary> &Result) const {
OwningPtr<MemoryBuffer> Buff;
if (error_code ec = getMemoryBuffer(Buff))
return ec;
- if (error_code ec = createBinary(Buff.take(), ret))
- return ec;
- Result.swap(ret);
+ ErrorOr<Binary *> BinaryOrErr = createBinary(Buff.take());
+ if (error_code EC = BinaryOrErr.getError())
+ return EC;
+ Result.reset(BinaryOrErr.get());
return object_error::success;
}
OpenPOWER on IntegriCloud