]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #52824 - varkor:fix-llvm-ret-move-warnings, r=rkruppe
authorPietro Albini <pietro@pietroalbini.org>
Wed, 1 Aug 2018 08:12:45 +0000 (10:12 +0200)
committerGitHub <noreply@github.com>
Wed, 1 Aug 2018 08:12:45 +0000 (10:12 +0200)
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]`).

src/rustllvm/PassWrapper.cpp

index 3f5550bf95fd234e8587590260fc833190d5b9fc..a13e4ffa8f8295cc50da40d3c3fe3b0735c6128a 100644 (file)
@@ -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
@@ -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);