diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp index 75dee95b7030c9..f21f144fe42401 100644 --- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp +++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp @@ -1022,7 +1022,7 @@ Expected writeOffloadFile(const OffloadFile &File) { if (Error Err = createOutputFile(Prefix + "-" + Binary.getTriple() + "-" + Binary.getArch(), Suffix, TempFile)) - return Err; + return std::move(Err); Expected> OutputOrErr = FileOutputBuffer::create(TempFile, Binary.getImage().size()); @@ -1032,7 +1032,7 @@ Expected writeOffloadFile(const OffloadFile &File) { std::copy(Binary.getImage().bytes_begin(), Binary.getImage().bytes_end(), Output->getBufferStart()); if (Error E = Output->commit()) - return E; + return std::move(E); return static_cast(TempFile); } @@ -1188,7 +1188,7 @@ linkAndWrapDeviceFiles(SmallVectorImpl &LinkerInputFiles) { // First link and remove all the input files containing bitcode. SmallVector InputFiles; if (Error Err = linkBitcodeFiles(Input, InputFiles, Triple, Arch)) - return Err; + return std::move(Err); // Write any remaining device inputs to an output file for the linker job. for (const OffloadFile &File : Input) {