summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor Guidry <trevor.guidry@mongodb.com>2022-09-22 22:11:45 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-22 22:45:04 +0000
commit2d74f2a4806bbf113ed13a3cbbd022e628664420 (patch)
treee028e356da61327564e3cfe0490613f3907d20b7
parent17e33729b052e5bc23f3fb3e3afcd66b55c6157a (diff)
downloadmongo-2d74f2a4806bbf113ed13a3cbbd022e628664420.tar.gz
SERVER-69908 fix clang_tidy on enterprise-rhel80-dynamic-clang-tidy-v4
-rw-r--r--src/mongo/client/sdam/topology_description.cpp2
-rw-r--r--src/mongo/db/index/column_key_generator_test.cpp4
-rw-r--r--src/mongo/db/query/ce/ce_histogram_test.cpp2
-rw-r--r--src/mongo/db/query/ce/max_diff.h2
-rw-r--r--src/mongo/db/query/ce/maxdiff_test_utils.cpp2
-rw-r--r--src/mongo/db/query/ce/maxdiff_test_utils.h2
-rw-r--r--src/mongo/db/query/ce/value_utils.cpp4
-rw-r--r--src/mongo/db/query/ce/value_utils.h4
-rw-r--r--src/mongo/db/query/sbe_and_hash_test.cpp2
-rw-r--r--src/mongo/db/query/sbe_and_sorted_test.cpp2
-rw-r--r--src/mongo/db/s/range_deleter_service.cpp6
-rw-r--r--src/mongo/db/s/resharding/resharding_manual_cleanup.cpp2
-rw-r--r--src/mongo/db/serverless/shard_split_utils.cpp2
13 files changed, 18 insertions, 18 deletions
diff --git a/src/mongo/client/sdam/topology_description.cpp b/src/mongo/client/sdam/topology_description.cpp
index 31d3a3e0760..6c4bc2dfea1 100644
--- a/src/mongo/client/sdam/topology_description.cpp
+++ b/src/mongo/client/sdam/topology_description.cpp
@@ -56,7 +56,7 @@ TopologyDescription::TopologyDescription(SdamConfiguration config)
: _type(config.getInitialType()), _setName(config.getSetName()) {
if (auto seeds = config.getSeedList()) {
_servers.clear();
- for (auto address : *seeds) {
+ for (const auto& address : *seeds) {
_servers.push_back(std::make_shared<ServerDescription>(address));
}
}
diff --git a/src/mongo/db/index/column_key_generator_test.cpp b/src/mongo/db/index/column_key_generator_test.cpp
index f235af478b8..cc873d1a6e8 100644
--- a/src/mongo/db/index/column_key_generator_test.cpp
+++ b/src/mongo/db/index/column_key_generator_test.cpp
@@ -311,7 +311,7 @@ void basicTests(int line,
for (auto&& [keyGen, expectedPaths] : expected) {
StringMap<UnencodedCellValue_ForTest> expected;
// Create expected by retrieving flags and vals from expected paths
- for (auto path : expectedPaths) {
+ for (const auto& path : expectedPaths) {
expected.insert({path, pathMap.find(path)->second});
}
// Add in the RowID column. Since it is always the same, tests shouldn't include it.
@@ -961,7 +961,7 @@ void updateTest(
std::vector<BSONElement> elems;
for (auto&& [keyGen, expectedPaths] : projPairs) {
StringMap<std::pair<ColumnKeyGenerator::DiffAction, UnencodedCellValue_ForTest>> expected;
- for (auto path : expectedPaths) {
+ for (const auto& path : expectedPaths) {
expected.insert({path, pathMap.find(path)->second});
}
StringSet seenPaths;
diff --git a/src/mongo/db/query/ce/ce_histogram_test.cpp b/src/mongo/db/query/ce/ce_histogram_test.cpp
index 7afab4ccf3e..70c884c6e8a 100644
--- a/src/mongo/db/query/ce/ce_histogram_test.cpp
+++ b/src/mongo/db/query/ce/ce_histogram_test.cpp
@@ -73,7 +73,7 @@ ScalarHistogram getHistogramFromData(std::vector<TestBucket> testBuckets) {
int cumulativeFreq = 0;
int cumulativeNDV = 0;
- for (auto b : testBuckets) {
+ for (const auto& b : testBuckets) {
// Add bucket boundary value to bounds.
auto [tag, val] = stage_builder::makeValue(b.val);
bounds.push_back(tag, val);
diff --git a/src/mongo/db/query/ce/max_diff.h b/src/mongo/db/query/ce/max_diff.h
index 267f304c089..8677bc57211 100644
--- a/src/mongo/db/query/ce/max_diff.h
+++ b/src/mongo/db/query/ce/max_diff.h
@@ -42,7 +42,7 @@ namespace mongo::ce {
struct ValFreq {
ValFreq(size_t idx, size_t freq) : _idx(idx), _freq(freq), _area(-1.0), _normArea(-1) {}
- const std::string toString() const {
+ std::string toString() const {
std::ostringstream os;
os << "idx: " << _idx << ", freq: " << _freq << ", area: " << _area
<< ", normArea: " << _normArea;
diff --git a/src/mongo/db/query/ce/maxdiff_test_utils.cpp b/src/mongo/db/query/ce/maxdiff_test_utils.cpp
index 5dfb5b105de..fdd42ff627b 100644
--- a/src/mongo/db/query/ce/maxdiff_test_utils.cpp
+++ b/src/mongo/db/query/ce/maxdiff_test_utils.cpp
@@ -96,7 +96,7 @@ std::string makeMatchExpr(const SBEValue& val, EstimationType cmpOp) {
return matchExpr.str();
}
-const ScalarHistogram makeHistogram(std::vector<SBEValue>& randData, size_t nBuckets) {
+ScalarHistogram makeHistogram(std::vector<SBEValue>& randData, size_t nBuckets) {
sortValueVector(randData);
const DataDistribution& dataDistrib = getDataDistribution(randData);
return genMaxDiffHistogram(dataDistrib, nBuckets);
diff --git a/src/mongo/db/query/ce/maxdiff_test_utils.h b/src/mongo/db/query/ce/maxdiff_test_utils.h
index e95aaf78315..b1367d7dcd8 100644
--- a/src/mongo/db/query/ce/maxdiff_test_utils.h
+++ b/src/mongo/db/query/ce/maxdiff_test_utils.h
@@ -73,7 +73,7 @@ std::string makeMatchExpr(const SBEValue& val, EstimationType cmpOp);
Given a vector of values, create a histogram reflection the distribution of the vector
with the supplied number of buckets.
*/
-const ScalarHistogram makeHistogram(std::vector<SBEValue>& randData, size_t nBuckets);
+ScalarHistogram makeHistogram(std::vector<SBEValue>& randData, size_t nBuckets);
/**
Serialize a vector of values.
diff --git a/src/mongo/db/query/ce/value_utils.cpp b/src/mongo/db/query/ce/value_utils.cpp
index d170eb5d6ae..9838f91a285 100644
--- a/src/mongo/db/query/ce/value_utils.cpp
+++ b/src/mongo/db/query/ce/value_utils.cpp
@@ -91,11 +91,11 @@ value::Value SBEValue::getValue() const {
return _val;
}
-const std::pair<value::TypeTags, value::Value> makeInt64Value(int v) {
+std::pair<value::TypeTags, value::Value> makeInt64Value(int v) {
return std::make_pair(value::TypeTags::NumberInt64, value::bitcastFrom<int64_t>(v));
};
-const std::pair<value::TypeTags, value::Value> makeNullValue() {
+std::pair<value::TypeTags, value::Value> makeNullValue() {
return std::make_pair(value::TypeTags::Null, 0);
};
diff --git a/src/mongo/db/query/ce/value_utils.h b/src/mongo/db/query/ce/value_utils.h
index a9d664b0b4c..8ede1362c37 100644
--- a/src/mongo/db/query/ce/value_utils.h
+++ b/src/mongo/db/query/ce/value_utils.h
@@ -64,12 +64,12 @@ private:
Generate an SBE Value pair that represents the supplied int with
type Int64
*/
-const std::pair<value::TypeTags, value::Value> makeInt64Value(int v);
+std::pair<value::TypeTags, value::Value> makeInt64Value(int v);
/**
Generate an SBE Value pair representing a BSON null value
*/
-const std::pair<value::TypeTags, value::Value> makeNullValue();
+std::pair<value::TypeTags, value::Value> makeNullValue();
/**
Do the supplied type tags represent the same BSON type?
diff --git a/src/mongo/db/query/sbe_and_hash_test.cpp b/src/mongo/db/query/sbe_and_hash_test.cpp
index 95f0d083cbc..217696b3cdf 100644
--- a/src/mongo/db/query/sbe_and_hash_test.cpp
+++ b/src/mongo/db/query/sbe_and_hash_test.cpp
@@ -48,7 +48,7 @@ protected:
std::unique_ptr<QuerySolutionNode> makeHashAndTree(
std::vector<std::vector<BSONArray>> docsVec) {
auto andHashNode = std::make_unique<AndHashNode>();
- for (auto docs : docsVec) {
+ for (const auto& docs : docsVec) {
auto virtScan =
std::make_unique<VirtualScanNode>(docs, VirtualScanNode::ScanType::kCollScan, true);
andHashNode->children.push_back(std::move(virtScan));
diff --git a/src/mongo/db/query/sbe_and_sorted_test.cpp b/src/mongo/db/query/sbe_and_sorted_test.cpp
index 45e0d38f3ac..eada10cb8bf 100644
--- a/src/mongo/db/query/sbe_and_sorted_test.cpp
+++ b/src/mongo/db/query/sbe_and_sorted_test.cpp
@@ -46,7 +46,7 @@ protected:
std::unique_ptr<QuerySolutionNode> makeAndSortedTree(
std::vector<std::vector<BSONArray>> docsVec) {
auto andSortedNode = std::make_unique<AndSortedNode>();
- for (auto docs : docsVec) {
+ for (const auto& docs : docsVec) {
auto virtScan =
std::make_unique<VirtualScanNode>(docs, VirtualScanNode::ScanType::kCollScan, true);
andSortedNode->children.push_back(std::move(virtScan));
diff --git a/src/mongo/db/s/range_deleter_service.cpp b/src/mongo/db/s/range_deleter_service.cpp
index e0027e09bfe..d27c71f3932 100644
--- a/src/mongo/db/s/range_deleter_service.cpp
+++ b/src/mongo/db/s/range_deleter_service.cpp
@@ -48,9 +48,9 @@ namespace mongo {
namespace {
const auto rangeDeleterServiceDecorator = ServiceContext::declareDecoration<RangeDeleterService>();
-const BSONObj getShardKeyPattern(OperationContext* opCtx,
- const DatabaseName& dbName,
- const UUID& collectionUuid) {
+BSONObj getShardKeyPattern(OperationContext* opCtx,
+ const DatabaseName& dbName,
+ const UUID& collectionUuid) {
while (true) {
opCtx->checkForInterrupt();
boost::optional<NamespaceString> optNss;
diff --git a/src/mongo/db/s/resharding/resharding_manual_cleanup.cpp b/src/mongo/db/s/resharding/resharding_manual_cleanup.cpp
index 74911c8518f..c9141a1a5b3 100644
--- a/src/mongo/db/s/resharding/resharding_manual_cleanup.cpp
+++ b/src/mongo/db/s/resharding/resharding_manual_cleanup.cpp
@@ -65,7 +65,7 @@ std::vector<AsyncRequestsSender::Request> createShardCleanupRequests(
auto participants = getAllParticipantsFromCoordDoc(doc);
std::vector<AsyncRequestsSender::Request> requests;
- for (auto participant : participants) {
+ for (const auto& participant : participants) {
requests.emplace_back(participant,
ShardsvrCleanupReshardCollection(nss, reshardingUUID).toBSON({}));
}
diff --git a/src/mongo/db/serverless/shard_split_utils.cpp b/src/mongo/db/serverless/shard_split_utils.cpp
index 2168526b22b..846543bf140 100644
--- a/src/mongo/db/serverless/shard_split_utils.cpp
+++ b/src/mongo/db/serverless/shard_split_utils.cpp
@@ -47,7 +47,7 @@ std::vector<repl::MemberConfig> getRecipientMembers(const repl::ReplSetConfig& c
const StringData& recipientTagName) {
std::vector<repl::MemberConfig> result;
const auto& tagConfig = config.getTagConfig();
- for (auto member : config.members()) {
+ for (const auto& member : config.members()) {
auto matchesTag =
std::any_of(member.tagsBegin(), member.tagsEnd(), [&](const repl::ReplSetTag& tag) {
return tagConfig.getTagKey(tag) == recipientTagName;