Revert "Remove redundant "std::move"s in return statements"
The build failed with
error: call to deleted constructor of 'llvm::Error'
errors.
This reverts commit 1c2241a7936bf85aa68aef94bd40c3ba77d8ddf2.
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 6b72593..03f0bb1 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -2518,7 +2518,7 @@
/* Scan the text. */
StringRef::iterator p = str.begin();
if (Error Err = interpretDecimal(p, str.end(), &D))
- return Err;
+ return std::move(Err);
/* Handle the quick cases. First the case of no significant digits,
i.e. zero, and then exponents that are obviously too large or too
diff --git a/llvm/lib/Support/FileCheck.cpp b/llvm/lib/Support/FileCheck.cpp
index 5c5a510..23e1ece 100644
--- a/llvm/lib/Support/FileCheck.cpp
+++ b/llvm/lib/Support/FileCheck.cpp
@@ -86,7 +86,7 @@
Err = joinErrors(std::move(Err), LeftOp.takeError());
if (!RightOp)
Err = joinErrors(std::move(Err), RightOp.takeError());
- return Err;
+ return std::move(Err);
}
return EvalBinop(*LeftOp, *RightOp);
@@ -284,7 +284,7 @@
FileCheckPatternContext *Context, const SourceMgr &SM) {
Expr = Expr.ltrim(SpaceChars);
if (Expr.empty())
- return LeftOp;
+ return std::move(LeftOp);
// Check if this is a supported operation and select a function to perform
// it.
@@ -425,7 +425,7 @@
DefinedNumericVariable = *ParseResult;
}
- return ExpressionPointer;
+ return std::move(ExpressionPointer);
}
bool Pattern::parsePattern(StringRef PatternStr, StringRef Prefix,
diff --git a/llvm/lib/Support/JSON.cpp b/llvm/lib/Support/JSON.cpp
index d44eafa..16b1d11 100644
--- a/llvm/lib/Support/JSON.cpp
+++ b/llvm/lib/Support/JSON.cpp
@@ -513,7 +513,7 @@
if (P.checkUTF8())
if (P.parseValue(E))
if (P.assertEnd())
- return E;
+ return std::move(E);
return P.takeError();
}
char ParseError::ID = 0;
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp
index a7c7c35..e4027ca 100644
--- a/llvm/lib/Support/MemoryBuffer.cpp
+++ b/llvm/lib/Support/MemoryBuffer.cpp
@@ -128,7 +128,7 @@
if (!Buf)
return make_error_code(errc::not_enough_memory);
memcpy(Buf->getBufferStart(), InputData.data(), InputData.size());
- return Buf;
+ return std::move(Buf);
}
std::unique_ptr<MemoryBuffer>
@@ -398,7 +398,7 @@
Offset, EC));
if (EC)
return EC;
- return Result;
+ return std::move(Result);
}
ErrorOr<std::unique_ptr<WriteThroughMemoryBuffer>>
@@ -450,7 +450,7 @@
new (NamedBufferAlloc(Filename)) MemoryBufferMMapFile<MB>(
RequiresNullTerminator, FD, MapSize, Offset, EC));
if (!EC)
- return Result;
+ return std::move(Result);
}
auto Buf = WritableMemoryBuffer::getNewUninitMemBuffer(MapSize, Filename);
@@ -475,7 +475,7 @@
Offset += *ReadBytes;
}
- return Buf;
+ return std::move(Buf);
}
ErrorOr<std::unique_ptr<MemoryBuffer>>
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index 85698f1..fa3bf47 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -1264,7 +1264,7 @@
return errorCodeToError(EC);
}
#endif
- return Ret;
+ return std::move(Ret);
}
}
diff --git a/llvm/lib/Support/YAMLTraits.cpp b/llvm/lib/Support/YAMLTraits.cpp
index de7da63..5f0cedc 100644
--- a/llvm/lib/Support/YAMLTraits.cpp
+++ b/llvm/lib/Support/YAMLTraits.cpp
@@ -388,7 +388,7 @@
break;
SQHNode->Entries.push_back(std::move(Entry));
}
- return SQHNode;
+ return std::move(SQHNode);
} else if (MappingNode *Map = dyn_cast<MappingNode>(N)) {
auto mapHNode = std::make_unique<MapHNode>(N);
for (KeyValueNode &KVN : *Map) {
@@ -413,7 +413,7 @@
break;
mapHNode->Mapping[KeyStr] = std::move(ValueHNode);
}
- return mapHNode;
+ return std::move(mapHNode);
} else if (isa<NullNode>(N)) {
return std::make_unique<EmptyHNode>(N);
} else {