diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-26 22:00:09 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-08-26 22:00:09 +0000 |
commit | e2c1d77fb41fd580d11c56cb1082eb505cfa1f18 (patch) | |
tree | 7bddf1234caf42b4bc4499106253242978683e38 /llvm/lib/IRReader | |
parent | 0056256b5595e8d8d3af2c927749092825454faf (diff) | |
download | llvm-e2c1d77fb41fd580d11c56cb1082eb505cfa1f18.zip llvm-e2c1d77fb41fd580d11c56cb1082eb505cfa1f18.tar.gz llvm-e2c1d77fb41fd580d11c56cb1082eb505cfa1f18.tar.bz2 |
Pass a std::unique_ptr<MemoryBuffer>& to getLazyBitcodeModule.
By taking a reference we can do the ownership transfer in one place instead of
expecting every caller to do it.
llvm-svn: 216492
Diffstat (limited to 'llvm/lib/IRReader')
-rw-r--r-- | llvm/lib/IRReader/IRReader.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/lib/IRReader/IRReader.cpp b/llvm/lib/IRReader/IRReader.cpp index 5c31248..a50e386 100644 --- a/llvm/lib/IRReader/IRReader.cpp +++ b/llvm/lib/IRReader/IRReader.cpp @@ -35,14 +35,12 @@ getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer, SMDiagnostic &Err, if (isBitcode((const unsigned char *)Buffer->getBufferStart(), (const unsigned char *)Buffer->getBufferEnd())) { std::string ErrMsg; - ErrorOr<Module *> ModuleOrErr = getLazyBitcodeModule(Buffer.get(), Context); + ErrorOr<Module *> ModuleOrErr = getLazyBitcodeModule(Buffer, Context); if (std::error_code EC = ModuleOrErr.getError()) { Err = SMDiagnostic(Buffer->getBufferIdentifier(), SourceMgr::DK_Error, EC.message()); return nullptr; } - // getLazyBitcodeModule takes ownership of the Buffer when successful. - Buffer.release(); return std::unique_ptr<Module>(ModuleOrErr.get()); } |