[clang] a9fd8b9 - [LinkerWrapper] Fix calls to deleted Error constructor on older compilers
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 22 06:39:48 PDT 2022
Author: Joseph Huber
Date: 2022-06-22T09:39:23-04:00
New Revision: a9fd8b911331dad1b5f94e3aba5ce0927e632ade
URL: https://github.com/llvm/llvm-project/commit/a9fd8b911331dad1b5f94e3aba5ce0927e632ade
DIFF: https://github.com/llvm/llvm-project/commit/a9fd8b911331dad1b5f94e3aba5ce0927e632ade.diff
LOG: [LinkerWrapper] Fix calls to deleted Error constructor on older compilers
Summary:
A recent patch added some new code paths to the linker wrapper. Older
compilers seem to have problems with returning errors wrapped in
an Excepted type without explicitly moving them. This caused failures in
some of the buildbots. This patch fixes that.
Added:
Modified:
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
Removed:
################################################################################
diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index 75dee95b7030..f21f144fe424 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -1022,7 +1022,7 @@ Expected<std::string> writeOffloadFile(const OffloadFile &File) {
if (Error Err = createOutputFile(Prefix + "-" + Binary.getTriple() + "-" +
Binary.getArch(),
Suffix, TempFile))
- return Err;
+ return std::move(Err);
Expected<std::unique_ptr<FileOutputBuffer>> OutputOrErr =
FileOutputBuffer::create(TempFile, Binary.getImage().size());
@@ -1032,7 +1032,7 @@ Expected<std::string> 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<std::string>(TempFile);
}
@@ -1188,7 +1188,7 @@ linkAndWrapDeviceFiles(SmallVectorImpl<OffloadFile> &LinkerInputFiles) {
// First link and remove all the input files containing bitcode.
SmallVector<std::string> 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) {
More information about the cfe-commits
mailing list