summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Tuckman <ted.tuckman@mongodb.com>2022-09-15 13:03:14 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-15 13:55:58 +0000
commit9b5cbbbc2d3cae926689e4e632daa73062bb1432 (patch)
tree431cc1b116363ae6918412ed55086a77db66ce24
parent1b942407096c139fdb69b1d61cfe20e4e5c0f1eb (diff)
downloadmongo-9b5cbbbc2d3cae926689e4e632daa73062bb1432.tar.gz
SERVER-68994 Fix AUTO_CAUSES_COPY coverity errors
-rw-r--r--src/mongo/db/commands/index_filter_commands.cpp2
-rw-r--r--src/mongo/db/cst/cst_match_translation.cpp2
-rw-r--r--src/mongo/db/matcher/rewrite_expr.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_densify.cpp2
-rw-r--r--src/mongo/db/pipeline/document_source_internal_unpack_bucket.cpp2
-rw-r--r--src/mongo/db/pipeline/expression.h2
-rw-r--r--src/mongo/db/query/planner_analysis.cpp2
7 files changed, 7 insertions, 7 deletions
diff --git a/src/mongo/db/commands/index_filter_commands.cpp b/src/mongo/db/commands/index_filter_commands.cpp
index f3f291bbae1..1497e7ae763 100644
--- a/src/mongo/db/commands/index_filter_commands.cpp
+++ b/src/mongo/db/commands/index_filter_commands.cpp
@@ -276,7 +276,7 @@ Status ClearFilters::clear(OperationContext* opCtx,
// removePlanCacheEntriesByPlanCacheCommandKeys() function with the key from the index filter
// entry.
stdx::unordered_set<uint32_t> planCacheCommandKeys;
- for (auto entry : entries) {
+ for (const auto& entry : entries) {
// Create canonical query.
auto findCommand = std::make_unique<FindCommandRequest>(nss);
findCommand->setFilter(entry.query);
diff --git a/src/mongo/db/cst/cst_match_translation.cpp b/src/mongo/db/cst/cst_match_translation.cpp
index ba7184e585f..11459e12a58 100644
--- a/src/mongo/db/cst/cst_match_translation.cpp
+++ b/src/mongo/db/cst/cst_match_translation.cpp
@@ -141,7 +141,7 @@ MatcherTypeSet getMatcherTypeSet(const CNode& argument) {
a.payload);
};
if (auto children = stdx::get_if<CNode::ArrayChildren>(&argument.payload)) {
- for (auto child : (*children)) {
+ for (const auto& child : (*children)) {
add_individual_to_type_set(child);
}
} else {
diff --git a/src/mongo/db/matcher/rewrite_expr.cpp b/src/mongo/db/matcher/rewrite_expr.cpp
index cd82adb7cd0..3ca73b289b0 100644
--- a/src/mongo/db/matcher/rewrite_expr.cpp
+++ b/src/mongo/db/matcher/rewrite_expr.cpp
@@ -233,7 +233,7 @@ bool RewriteExpr::_canRewriteComparison(
const auto& operandList = expression->getOperandList();
bool hasFieldPath = false;
- for (auto operand : operandList) {
+ for (auto& operand : operandList) {
if (auto exprFieldPath = dynamic_cast<ExpressionFieldPath*>(operand.get())) {
if (exprFieldPath->isVariableReference() || exprFieldPath->isROOT()) {
// Rather than a local document field path, this field path refers to either a
diff --git a/src/mongo/db/pipeline/document_source_densify.cpp b/src/mongo/db/pipeline/document_source_densify.cpp
index 2fd25d5c3ca..addddc34708 100644
--- a/src/mongo/db/pipeline/document_source_densify.cpp
+++ b/src/mongo/db/pipeline/document_source_densify.cpp
@@ -152,7 +152,7 @@ list<intrusive_ptr<DocumentSource>> createFromBsonInternal(
list<FieldPath> partitions;
if (spec.getPartitionByFields()) {
auto partitionFields = (*spec.getPartitionByFields());
- for (auto partitionField : partitionFields)
+ for (auto& partitionField : partitionFields)
partitions.push_back(FieldPath(partitionField));
}
diff --git a/src/mongo/db/pipeline/document_source_internal_unpack_bucket.cpp b/src/mongo/db/pipeline/document_source_internal_unpack_bucket.cpp
index 871a81df95a..d4d38a2b2be 100644
--- a/src/mongo/db/pipeline/document_source_internal_unpack_bucket.cpp
+++ b/src/mongo/db/pipeline/document_source_internal_unpack_bucket.cpp
@@ -941,7 +941,7 @@ bool DocumentSourceInternalUnpackBucket::optimizeLastpoint(Pipeline::SourceConta
auto isSortValidForGroup = [&](AccumulatorDocumentsNeeded targetAccum) {
bool firstpointTimeIsAscending =
(targetAccum == AccumulatorDocumentsNeeded::kFirstDocument);
- for (auto entry : sortStage->getSortKeyPattern()) {
+ for (const auto& entry : sortStage->getSortKeyPattern()) {
auto isTimeField = entry.fieldPath->fullPath() == timeField;
if (isTimeField && (entry.isAscending == firstpointTimeIsAscending)) {
// This is a first-point query, which is disallowed.
diff --git a/src/mongo/db/pipeline/expression.h b/src/mongo/db/pipeline/expression.h
index 4680181b295..918173b50ba 100644
--- a/src/mongo/db/pipeline/expression.h
+++ b/src/mongo/db/pipeline/expression.h
@@ -559,7 +559,7 @@ public:
// Verify that '_output' produces an array and pass each element to 'process'.
auto output = _output->evaluate(root, variables);
uassert(5788200, "Input must be an array", output.isArray());
- for (auto item : output.getArray()) {
+ for (auto& item : output.getArray()) {
accum.process(item, false);
}
return accum.getValue(false);
diff --git a/src/mongo/db/query/planner_analysis.cpp b/src/mongo/db/query/planner_analysis.cpp
index a4ef137a7e5..62afaa03e98 100644
--- a/src/mongo/db/query/planner_analysis.cpp
+++ b/src/mongo/db/query/planner_analysis.cpp
@@ -753,7 +753,7 @@ void QueryPlannerAnalysis::analyzeGeo(const QueryPlannerParams& params,
continue;
}
- for (auto elt : indexEntry.keyPattern) {
+ for (auto& elt : indexEntry.keyPattern) {
if (elt.type() == BSONType::String && elt.String() == "2dsphere") {
twoDSphereFields.insert(elt.fieldName());
}