mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 04:09:45 +00:00
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:
parent
38a4f3bbec
commit
6d66a1cd2f
@ -28,9 +28,9 @@ namespace llvm {
|
|||||||
class raw_ostream;
|
class raw_ostream;
|
||||||
|
|
||||||
/// Read the header of the specified bitcode buffer and prepare for lazy
|
/// Read the header of the specified bitcode buffer and prepare for lazy
|
||||||
/// deserialization of function bodies. If successful, this takes ownership
|
/// deserialization of function bodies. If successful, this moves Buffer. On
|
||||||
/// of 'buffer. On error, this *does not* take ownership of Buffer.
|
/// error, this *does not* move Buffer.
|
||||||
ErrorOr<Module *> getLazyBitcodeModule(std::unique_ptr<MemoryBuffer> &Buffer,
|
ErrorOr<Module *> getLazyBitcodeModule(std::unique_ptr<MemoryBuffer> &&Buffer,
|
||||||
LLVMContext &Context);
|
LLVMContext &Context);
|
||||||
|
|
||||||
/// getStreamedBitcodeModule - Read the header of the specified stream
|
/// getStreamedBitcodeModule - Read the header of the specified stream
|
||||||
|
@ -54,7 +54,7 @@ LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
|
|||||||
std::unique_ptr<MemoryBuffer> Owner(unwrap(MemBuf));
|
std::unique_ptr<MemoryBuffer> Owner(unwrap(MemBuf));
|
||||||
|
|
||||||
ErrorOr<Module *> ModuleOrErr =
|
ErrorOr<Module *> ModuleOrErr =
|
||||||
getLazyBitcodeModule(Owner, *unwrap(ContextRef));
|
getLazyBitcodeModule(std::move(Owner), *unwrap(ContextRef));
|
||||||
Owner.release();
|
Owner.release();
|
||||||
|
|
||||||
if (std::error_code EC = ModuleOrErr.getError()) {
|
if (std::error_code EC = ModuleOrErr.getError()) {
|
||||||
|
@ -3520,7 +3520,7 @@ const std::error_category &llvm::BitcodeErrorCategory() {
|
|||||||
/// \param[in] WillMaterializeAll Set to \c true if the caller promises to
|
/// \param[in] WillMaterializeAll Set to \c true if the caller promises to
|
||||||
/// materialize everything -- in particular, if this isn't truly lazy.
|
/// materialize everything -- in particular, if this isn't truly lazy.
|
||||||
static ErrorOr<Module *>
|
static ErrorOr<Module *>
|
||||||
getLazyBitcodeModuleImpl(std::unique_ptr<MemoryBuffer> &Buffer,
|
getLazyBitcodeModuleImpl(std::unique_ptr<MemoryBuffer> &&Buffer,
|
||||||
LLVMContext &Context, bool WillMaterializeAll) {
|
LLVMContext &Context, bool WillMaterializeAll) {
|
||||||
Module *M = new Module(Buffer->getBufferIdentifier(), Context);
|
Module *M = new Module(Buffer->getBufferIdentifier(), Context);
|
||||||
BitcodeReader *R = new BitcodeReader(Buffer.get(), Context);
|
BitcodeReader *R = new BitcodeReader(Buffer.get(), Context);
|
||||||
@ -3545,9 +3545,9 @@ getLazyBitcodeModuleImpl(std::unique_ptr<MemoryBuffer> &Buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<Module *>
|
ErrorOr<Module *>
|
||||||
llvm::getLazyBitcodeModule(std::unique_ptr<MemoryBuffer> &Buffer,
|
llvm::getLazyBitcodeModule(std::unique_ptr<MemoryBuffer> &&Buffer,
|
||||||
LLVMContext &Context) {
|
LLVMContext &Context) {
|
||||||
return getLazyBitcodeModuleImpl(Buffer, Context, false);
|
return getLazyBitcodeModuleImpl(std::move(Buffer), Context, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Module *llvm::getStreamedBitcodeModule(const std::string &name,
|
Module *llvm::getStreamedBitcodeModule(const std::string &name,
|
||||||
@ -3569,7 +3569,8 @@ Module *llvm::getStreamedBitcodeModule(const std::string &name,
|
|||||||
ErrorOr<Module *> llvm::parseBitcodeFile(MemoryBufferRef Buffer,
|
ErrorOr<Module *> llvm::parseBitcodeFile(MemoryBufferRef Buffer,
|
||||||
LLVMContext &Context) {
|
LLVMContext &Context) {
|
||||||
std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getMemBuffer(Buffer, false);
|
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)
|
if (!ModuleOrErr)
|
||||||
return ModuleOrErr;
|
return ModuleOrErr;
|
||||||
Module *M = ModuleOrErr.get();
|
Module *M = ModuleOrErr.get();
|
||||||
|
@ -35,7 +35,8 @@ getLazyIRModule(std::unique_ptr<MemoryBuffer> Buffer, SMDiagnostic &Err,
|
|||||||
if (isBitcode((const unsigned char *)Buffer->getBufferStart(),
|
if (isBitcode((const unsigned char *)Buffer->getBufferStart(),
|
||||||
(const unsigned char *)Buffer->getBufferEnd())) {
|
(const unsigned char *)Buffer->getBufferEnd())) {
|
||||||
std::string ErrMsg;
|
std::string ErrMsg;
|
||||||
ErrorOr<Module *> ModuleOrErr = getLazyBitcodeModule(Buffer, Context);
|
ErrorOr<Module *> ModuleOrErr =
|
||||||
|
getLazyBitcodeModule(std::move(Buffer), Context);
|
||||||
if (std::error_code EC = ModuleOrErr.getError()) {
|
if (std::error_code EC = ModuleOrErr.getError()) {
|
||||||
Err = SMDiagnostic(Buffer->getBufferIdentifier(), SourceMgr::DK_Error,
|
Err = SMDiagnostic(Buffer->getBufferIdentifier(), SourceMgr::DK_Error,
|
||||||
EC.message());
|
EC.message());
|
||||||
|
@ -270,7 +270,7 @@ llvm::object::IRObjectFile::createIRObjectFile(MemoryBufferRef Object,
|
|||||||
|
|
||||||
std::unique_ptr<MemoryBuffer> Buff(MemoryBuffer::getMemBuffer(Object, false));
|
std::unique_ptr<MemoryBuffer> Buff(MemoryBuffer::getMemBuffer(Object, false));
|
||||||
|
|
||||||
ErrorOr<Module *> MOrErr = getLazyBitcodeModule(Buff, Context);
|
ErrorOr<Module *> MOrErr = getLazyBitcodeModule(std::move(Buff), Context);
|
||||||
if (std::error_code EC = MOrErr.getError())
|
if (std::error_code EC = MOrErr.getError())
|
||||||
return EC;
|
return EC;
|
||||||
|
|
||||||
|
@ -552,7 +552,7 @@ getModuleForFile(LLVMContext &Context, claimed_file &F, raw_fd_ostream *ApiFile,
|
|||||||
if (release_input_file(F.handle) != LDPS_OK)
|
if (release_input_file(F.handle) != LDPS_OK)
|
||||||
message(LDPL_FATAL, "Failed to release file information");
|
message(LDPL_FATAL, "Failed to release file information");
|
||||||
|
|
||||||
ErrorOr<Module *> MOrErr = getLazyBitcodeModule(Buffer, Context);
|
ErrorOr<Module *> MOrErr = getLazyBitcodeModule(std::move(Buffer), Context);
|
||||||
|
|
||||||
if (std::error_code EC = MOrErr.getError())
|
if (std::error_code EC = MOrErr.getError())
|
||||||
message(LDPL_FATAL, "Could not read bitcode from file : %s",
|
message(LDPL_FATAL, "Could not read bitcode from file : %s",
|
||||||
|
@ -53,7 +53,8 @@ static std::unique_ptr<Module> getLazyModuleFromAssembly(LLVMContext &Context,
|
|||||||
writeModuleToBuffer(parseAssembly(Assembly), Mem);
|
writeModuleToBuffer(parseAssembly(Assembly), Mem);
|
||||||
std::unique_ptr<MemoryBuffer> Buffer =
|
std::unique_ptr<MemoryBuffer> Buffer =
|
||||||
MemoryBuffer::getMemBuffer(Mem.str(), "test", false);
|
MemoryBuffer::getMemBuffer(Mem.str(), "test", false);
|
||||||
ErrorOr<Module *> ModuleOrErr = getLazyBitcodeModule(Buffer, Context);
|
ErrorOr<Module *> ModuleOrErr =
|
||||||
|
getLazyBitcodeModule(std::move(Buffer), Context);
|
||||||
return std::unique_ptr<Module>(ModuleOrErr.get());
|
return std::unique_ptr<Module>(ModuleOrErr.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user