Skip to content

Commit 02e9a4c

Browse files
committed
clang tidy generates use-after-move warning
clang-tidy original warning: /home/suyash/ceph/src/cls/queue/cls_queue_src.cc:330:50: warning: 'bl' used after it was moved [bugprone-use-after-move] uint64_t entry_start_offset = start_offset - bl.length(); ^ /home/suyash/ceph/src/cls/queue/cls_queue_src.cc:333:14: note: move occurred here bl_chunk = std::move(bl); ^ /home/suyash/ceph/src/cls/queue/cls_queue_src.cc:330:50: note: the use happens in a later loop iteration than the move uint64_t entry_start_offset = start_offset - bl.length(); ^ Fixes: https://tracker.ceph.com/issues/66356 Signed-off-by: Suyash Dongre <[email protected]>
1 parent 8c4f910 commit 02e9a4c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cls/queue/cls_queue_src.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,11 @@ int queue_list_entries(cls_method_context_t hctx, const cls_queue_list_op& op, c
327327
}
328328

329329
//If there is leftover data from previous iteration, append new data to leftover data
330-
uint64_t entry_start_offset = start_offset - bl.length();
330+
uint64_t entry_start_offset = start_offset - bl.length(); //NOLINT(bugprone-use-after-move)
331331
CLS_LOG(20, "INFO: queue_list_entries(): Entry start offset accounting for leftover data is %lu", entry_start_offset);
332332
bl.claim_append(bl_chunk);
333333
bl_chunk = std::move(bl);
334-
334+
bl.clear(); //NOLINT(bugprone-use-after-move)
335335
CLS_LOG(20, "INFO: queue_list_entries(): size of chunk %u", bl_chunk.length());
336336

337337
//Process the chunk of data read

0 commit comments

Comments
 (0)