Skip to content

Commit f733cdd

Browse files
committed
Fix 'range-loop-analysis' warnings
As reported by Apple clang 12, fix a couple of instances where we make unnecessary copies in range-based for loops: loop variable 'entry' is always a copy because the range of type 'const flatbuffers::Vector<flatbuffers::Offset<Collection> >' does not return a reference [-Wrange-loop-analysis] for (const auto& entry : *open->entries()) { ^ note: use non-reference type 'const Collections::KVStore::Collection *' for (const auto& entry : *open->entries()) { ^~~~~~~~~~~~~~~~~~~ Change-Id: I0967c0e74193588c6354d0e06709942a1068e9cf Reviewed-on: http://review.couchbase.org/c/kv_engine/+/137829 Tested-by: Build Bot <[email protected]> Reviewed-by: Richard de Mellow <[email protected]>
1 parent 6921dc3 commit f733cdd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

engines/ep/src/collections/flush.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ flatbuffers::DetachedBuffer Flush::encodeOpenCollections(
404404
currentCollections, "encodeOpenCollections()");
405405
auto open = flatbuffers::GetRoot<Collections::KVStore::OpenCollections>(
406406
currentCollections.data());
407-
for (const auto& entry : *open->entries()) {
407+
for (const auto* entry : *open->entries()) {
408408
// For each currently open collection, is it in the dropped map?
409409
auto result = droppedCollections.find(entry->collectionId());
410410

@@ -529,7 +529,7 @@ flatbuffers::DetachedBuffer Flush::encodeOpenScopes(
529529
auto fbData = flatbuffers::GetRoot<Collections::KVStore::Scopes>(
530530
existingScopes.data());
531531

532-
for (const auto& entry : *fbData->entries()) {
532+
for (const auto* entry : *fbData->entries()) {
533533
auto result = droppedScopes.find(entry->scopeId());
534534

535535
// If not found in dropped scopes add to output
@@ -561,4 +561,4 @@ flatbuffers::DetachedBuffer Flush::encodeOpenScopes(
561561
return builder.Release();
562562
}
563563

564-
} // namespace Collections::VB
564+
} // namespace Collections::VB

0 commit comments

Comments
 (0)