[PATCH] D87436: [NFC] Fix pessimizing-move warnings due to std::move in return statements
Yang Fan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 00:10:15 PDT 2020
nullptr.cpp created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
nullptr.cpp requested review of this revision.
Gcc warning:
warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
return std::move(Err);
^
Fix by removing redundant `std::move` in return statements.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87436
Files:
llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h
Index: llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h
===================================================================
--- llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h
+++ llvm/include/llvm/ExecutionEngine/Orc/RPC/RPCUtils.h
@@ -1525,20 +1525,20 @@
Args...)) {
detail::ResultTraits<typename Func::ReturnType>::consumeAbandoned(
std::move(Result));
- return std::move(Err);
+ return Err;
}
if (auto Err = this->C.send()) {
detail::ResultTraits<typename Func::ReturnType>::consumeAbandoned(
std::move(Result));
- return std::move(Err);
+ return Err;
}
while (!ReceivedResponse) {
if (auto Err = this->handleOne()) {
detail::ResultTraits<typename Func::ReturnType>::consumeAbandoned(
std::move(Result));
- return std::move(Err);
+ return Err;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87436.290889.patch
Type: text/x-patch
Size: 911 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200910/c95dccb6/attachment.bin>
More information about the llvm-commits
mailing list