Skip to content

Commit 94b769f

Browse files
committed
CBD-6348: [BP] clang-analyzer: Use after move warnings
Fix warnings reported as "use after move" appearing after upgrade to clang 15 Change-Id: Ia9eaac4c5a938cb317932421c1b1bdb7adc8eb46 Reviewed-on: https://review.couchbase.org/c/kv_engine/+/235168 Reviewed-by: Faizan Alam <[email protected]> Tested-by: Trond Norbye <[email protected]> Well-Formed: Restriction Checker
1 parent 10d375b commit 94b769f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

daemon/external_auth_manager_thread.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ void ExternalAuthManagerThread::setRbacCacheEpoch(
241241
}
242242

243243
void ExternalAuthManagerThread::processResponseQueue() {
244-
auto responses = std::move(incommingResponse);
244+
decltype(incommingResponse) responses;
245+
responses.swap(incommingResponse);
245246
while (!responses.empty()) {
246247
const auto& entry = responses.front();
247248
auto iter = requestMap.find(entry->opaque);
@@ -260,7 +261,8 @@ void ExternalAuthManagerThread::processResponseQueue() {
260261
}
261262
}
262263
void ExternalAuthManagerThread::purgePendingDeadConnections() {
263-
auto pending = std::move(pendingRemoveConnection);
264+
decltype(pendingRemoveConnection) pending;
265+
pending.swap(pendingRemoveConnection);
264266
for (const auto& connection : pending) {
265267
LOG_WARNING_RAW(
266268
"External authentication manager died. Expect "

executor/cb3_executorthread.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void CB3ExecutorThread::resetCurrentTask() {
171171
std::lock_guard<std::mutex> lh(currentTaskMutex);
172172
// move currentTask so we 'steal' the pointer and ensure currentTask
173173
// owns nothing.
174-
resetThisObject = std::move(currentTask);
174+
resetThisObject.swap(currentTask);
175175
}
176176
{
177177
// Freeing of the Task object should be accounted to the engine

0 commit comments

Comments
 (0)