Skip to content

Commit

Permalink
Rollup merge of rust-lang#52824 - varkor:fix-llvm-ret-move-warnings, …
Browse files Browse the repository at this point in the history
…r=rkruppe

Fix -Wpessimizing-move warnings in rustllvm/PassWrapper

These are producing warnings when building rustc (`warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]`).
  • Loading branch information
Mark-Simulacrum authored Aug 1, 2018
2 parents 16ec9bb + 9ccd7ee commit 6bc7dda
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/rustllvm/PassWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data, LLVMModuleRef M) {
auto MOrErr = getLazyBitcodeModule(Memory, Context, true, true);

if (!MOrErr)
return std::move(MOrErr);
return MOrErr;

// The rest of this closure is a workaround for
// https://bugs.llvm.org/show_bug.cgi?id=38184 where during ThinLTO imports
Expand All @@ -1093,14 +1093,14 @@ LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data, LLVMModuleRef M) {
// shouldn't be a perf hit.
if (Error Err = (*MOrErr)->materializeMetadata()) {
Expected<std::unique_ptr<Module>> Ret(std::move(Err));
return std::move(Ret);
return Ret;
}

auto *WasmCustomSections = (*MOrErr)->getNamedMetadata("wasm.custom_sections");
if (WasmCustomSections)
WasmCustomSections->eraseFromParent();

return std::move(MOrErr);
return MOrErr;
};
FunctionImporter Importer(Data->Index, Loader);
Expected<bool> Result = Importer.importFunctions(Mod, ImportList);
Expand Down

0 comments on commit 6bc7dda

Please sign in to comment.