Pass a && to getLazyBitcodeModule.

This forces callers to use std::move when calling it. It is somewhat odd to have
code with std::move that doesn't always move, but it is also odd to have code
without std::move that sometimes moves.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217049 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-09-03 17:31:46 +00:00
parent 38a4f3bbec
commit 6d66a1cd2f
7 changed files with 15 additions and 12 deletions

View File

@ -3520,7 +3520,7 @@ const std::error_category &llvm::BitcodeErrorCategory() {
/// \param[in] WillMaterializeAll Set to \c true if the caller promises to
/// materialize everything -- in particular, if this isn't truly lazy.
static ErrorOr<Module *>
getLazyBitcodeModuleImpl(std::unique_ptr<MemoryBuffer> &Buffer,
getLazyBitcodeModuleImpl(std::unique_ptr<MemoryBuffer> &&Buffer,
LLVMContext &Context, bool WillMaterializeAll) {
Module *M = new Module(Buffer->getBufferIdentifier(), Context);
BitcodeReader *R = new BitcodeReader(Buffer.get(), Context);
@ -3545,9 +3545,9 @@ getLazyBitcodeModuleImpl(std::unique_ptr<MemoryBuffer> &Buffer,
}
ErrorOr<Module *>
llvm::getLazyBitcodeModule(std::unique_ptr<MemoryBuffer> &Buffer,
llvm::getLazyBitcodeModule(std::unique_ptr<MemoryBuffer> &&Buffer,
LLVMContext &Context) {
return getLazyBitcodeModuleImpl(Buffer, Context, false);
return getLazyBitcodeModuleImpl(std::move(Buffer), Context, false);
}
Module *llvm::getStreamedBitcodeModule(const std::string &name,
@ -3569,7 +3569,8 @@ Module *llvm::getStreamedBitcodeModule(const std::string &name,
ErrorOr<Module *> llvm::parseBitcodeFile(MemoryBufferRef Buffer,
LLVMContext &Context) {
std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getMemBuffer(Buffer, false);
ErrorOr<Module *> ModuleOrErr = getLazyBitcodeModuleImpl(Buf, Context, true);
ErrorOr<Module *> ModuleOrErr =
getLazyBitcodeModuleImpl(std::move(Buf), Context, true);
if (!ModuleOrErr)
return ModuleOrErr;
Module *M = ModuleOrErr.get();