diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-23 22:00:37 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-23 22:00:37 +0000 |
| commit | 6304e941082cc97240856ff602f4ae0dfcc08230 (patch) | |
| tree | b41276453a57d065caf55cb342366b79ac81b11b /llvm/lib/ExecutionEngine | |
| parent | aed5c966849821b5368f0e742439bae579f42da3 (diff) | |
| download | bcm5719-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/ExecutionEngine')
| -rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h b/llvm/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h index 4917b93a96e..c3a21823bbc 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/ObjectImageCommon.h @@ -48,7 +48,8 @@ public: { // FIXME: error checking? createObjectFile returns an ErrorOr<ObjectFile*> // and should probably be checked for failure. - ObjFile.reset(object::ObjectFile::createObjectFile(Buffer->getMemBuffer()).get()); + std::unique_ptr<MemoryBuffer> Buf(Buffer->getMemBuffer()); + ObjFile.reset(object::ObjectFile::createObjectFile(Buf).get()); } ObjectImageCommon(std::unique_ptr<object::ObjectFile> Input) : ObjectImage(nullptr), ObjFile(std::move(Input)) {} |

