Skip to content

Commit 80d8dff

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/+/234817 Reviewed-by: Pavlos Georgiou <[email protected]> Well-Formed: Restriction Checker Tested-by: Trond Norbye <[email protected]>
1 parent 3dfa40b commit 80d8dff

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
@@ -243,7 +243,8 @@ void ExternalAuthManagerThread::setRbacCacheEpoch(
243243
}
244244

245245
void ExternalAuthManagerThread::processResponseQueue() {
246-
auto responses = std::move(incommingResponse);
246+
decltype(incommingResponse) responses;
247+
responses.swap(incommingResponse);
247248
while (!responses.empty()) {
248249
const auto& entry = responses.front();
249250
auto iter = requestMap.find(entry->opaque);
@@ -262,7 +263,8 @@ void ExternalAuthManagerThread::processResponseQueue() {
262263
}
263264
}
264265
void ExternalAuthManagerThread::purgePendingDeadConnections() {
265-
auto pending = std::move(pendingRemoveConnection);
266+
decltype(pendingRemoveConnection) pending;
267+
pending.swap(pendingRemoveConnection);
266268
for (const auto& connection : pending) {
267269
LOG_WARNING_RAW(
268270
"External authentication manager died. Expect "

executor/cb3_executorthread.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void CB3ExecutorThread::resetCurrentTask() {
164164
std::lock_guard<std::mutex> lh(currentTaskMutex);
165165
// move currentTask so we 'steal' the pointer and ensure currentTask
166166
// owns nothing.
167-
resetThisObject = std::move(currentTask);
167+
resetThisObject.swap(currentTask);
168168
}
169169
{
170170
// Freeing of the Task object should be accounted to the engine

0 commit comments

Comments
 (0)