Avoid pessimizing moves in threaded_queue.hh

Clang produces warnings during compilation:

ccls/src/threaded_queue.hh:150:27: warning: moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
ccls/src/threaded_queue.hh:150:27: note: remove ‘std::move’ call

This patch fixes the issue.
This commit is contained in:
TÖRÖK Attila 2019-06-13 12:13:01 +02:00 committed by GitHub
parent d3808de26a
commit b2842b20cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,7 +147,7 @@ public:
auto val = std::move(q->front());
q->pop_front();
--total_count_;
return std::move(val);
return val;
};
if (!priority_.empty())
return execute(&priority_);
@ -162,7 +162,7 @@ public:
auto val = std::move(q->front());
q->pop_front();
--total_count_;
return std::move(val);
return val;
};
if (priority_.size())
return execute(&priority_);