diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2020-09-24 14:31:15 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-25 17:26:09 +0000 |
commit | deb9f8e6bf9517061404cf2f476cd08f60687d83 (patch) | |
tree | b6c962dbc53f972b35766789a2170d961eb50c34 /src/mongo/db | |
parent | 8e53f9b4db4f3cc2c09e6a3fa2c29781142eb896 (diff) | |
download | mongo-deb9f8e6bf9517061404cf2f476cd08f60687d83.tar.gz |
SERVER-51084 tweak range loop variable types to fix xcode build
Diffstat (limited to 'src/mongo/db')
21 files changed, 28 insertions, 28 deletions
diff --git a/src/mongo/db/auth/builtin_roles_test.cpp b/src/mongo/db/auth/builtin_roles_test.cpp index 91fe31363e2..e58ca9b2bf6 100644 --- a/src/mongo/db/auth/builtin_roles_test.cpp +++ b/src/mongo/db/auth/builtin_roles_test.cpp @@ -114,7 +114,7 @@ TEST(BuiltinRoles, addPrivilegsForBuiltinRole) { const auto adminSystemJS = ResourcePattern::forExactNamespace(NamespaceString("admin", "system.js")); - for (const auto priv : privs) { + for (const auto& priv : privs) { auto resource = priv.getResourcePattern(); ASSERT((resource == adminDB) || (resource == adminSystemJS)); ASSERT(priv.getActions() == expSet); diff --git a/src/mongo/db/commands/apply_ops_cmd.cpp b/src/mongo/db/commands/apply_ops_cmd.cpp index c6b60e3166d..afaecb05de4 100644 --- a/src/mongo/db/commands/apply_ops_cmd.cpp +++ b/src/mongo/db/commands/apply_ops_cmd.cpp @@ -90,7 +90,7 @@ OplogApplicationValidity validateApplyOpsCommand(const BSONObj& cmdObj) { auto operationContainsUUID = [](const BSONObj& opObj) { auto anyTopLevelElementIsUUID = [](const BSONObj& opObj) { - for (const BSONElement opElement : opObj) { + for (const BSONElement& opElement : opObj) { if (opElement.type() == BSONType::BinData && opElement.binDataType() == BinDataType::newUUID) { return true; diff --git a/src/mongo/db/commands/generic.cpp b/src/mongo/db/commands/generic.cpp index af73d11052b..f13a73aa257 100644 --- a/src/mongo/db/commands/generic.cpp +++ b/src/mongo/db/commands/generic.cpp @@ -166,7 +166,7 @@ public: BSONObjBuilder& result) { // Sort the command names before building the result BSON. std::vector<Command*> commands; - for (const auto command : globalCommandRegistry()->allCommands()) { + for (const auto& command : globalCommandRegistry()->allCommands()) { // Don't show oldnames if (command.first == command.second->getName()) commands.push_back(command.second); diff --git a/src/mongo/db/commands/tenant_migration_donor_cmds.cpp b/src/mongo/db/commands/tenant_migration_donor_cmds.cpp index 9acba8c15e3..5b683aeddd3 100644 --- a/src/mongo/db/commands/tenant_migration_donor_cmds.cpp +++ b/src/mongo/db/commands/tenant_migration_donor_cmds.cpp @@ -64,7 +64,7 @@ public: uassertStatusOK( MongoURI::parse(requestBody.getRecipientConnectionString().toString())) .getServers(); - for (const auto server : donorServers) { + for (const auto& server : donorServers) { uassert(ErrorCodes::InvalidOptions, "recipient and donor hosts must be different", std::none_of(recipientServers.begin(), diff --git a/src/mongo/db/index/btree_key_generator.cpp b/src/mongo/db/index/btree_key_generator.cpp index e48097a08cb..b0f058f811f 100644 --- a/src/mongo/db/index/btree_key_generator.cpp +++ b/src/mongo/db/index/btree_key_generator.cpp @@ -505,7 +505,7 @@ void BtreeKeyGenerator::_getKeysWithArray(std::vector<const char*>* fieldNames, // Generate a key for each element of the indexed array. std::vector<const char*> fieldNamesTemp; std::vector<BSONElement> fixedTemp; - for (const auto arrObjElem : arrObj) { + for (const auto& arrObjElem : arrObj) { _getKeysArrEltFixed(*fieldNames, *fixed, &fieldNamesTemp, diff --git a/src/mongo/db/index/btree_key_generator_test.cpp b/src/mongo/db/index/btree_key_generator_test.cpp index 47b441c6f62..31ee59cf177 100644 --- a/src/mongo/db/index/btree_key_generator_test.cpp +++ b/src/mongo/db/index/btree_key_generator_test.cpp @@ -70,9 +70,9 @@ std::string dumpMultikeyPaths(const MultikeyPaths& multikeyPaths) { std::stringstream ss; ss << "[ "; - for (const auto multikeyComponents : multikeyPaths) { + for (const auto& multikeyComponents : multikeyPaths) { ss << "[ "; - for (const auto multikeyComponent : multikeyComponents) { + for (const auto& multikeyComponent : multikeyComponents) { ss << multikeyComponent << " "; } ss << "] "; diff --git a/src/mongo/db/index/expression_keys_private.cpp b/src/mongo/db/index/expression_keys_private.cpp index ce38cbf9cf4..73848d512f1 100644 --- a/src/mongo/db/index/expression_keys_private.cpp +++ b/src/mongo/db/index/expression_keys_private.cpp @@ -552,7 +552,7 @@ void ExpressionKeysPrivate::getS2Keys(SharedBufferFragmentBuilder& pooledBufferB size_t posInIdx = 0; // We output keys in the same order as the fields we index. - for (const auto keyElem : keyPattern) { + for (const auto& keyElem : keyPattern) { // First, we get the keys that this field adds. Either they're added literally from // the value of the field, or they're transformed if the field is geo. BSONElementSet fieldElements; diff --git a/src/mongo/db/index/index_access_method.cpp b/src/mongo/db/index/index_access_method.cpp index dd9c8b22863..1a510c09b49 100644 --- a/src/mongo/db/index/index_access_method.cpp +++ b/src/mongo/db/index/index_access_method.cpp @@ -444,7 +444,7 @@ Status AbstractIndexAccessMethod::update(OperationContext* opCtx, } // Add all new data keys into the index. - for (const auto keyString : ticket.added) { + for (const auto& keyString : ticket.added) { Status status = _newInterface->insert(opCtx, keyString, ticket.dupsAllowed); if (!status.isOK()) return status; diff --git a/src/mongo/db/index/s2_key_generator_test.cpp b/src/mongo/db/index/s2_key_generator_test.cpp index a8b3d17e4ec..301d598dfe1 100644 --- a/src/mongo/db/index/s2_key_generator_test.cpp +++ b/src/mongo/db/index/s2_key_generator_test.cpp @@ -65,9 +65,9 @@ std::string dumpMultikeyPaths(const MultikeyPaths& multikeyPaths) { std::stringstream ss; ss << "[ "; - for (const auto multikeyComponents : multikeyPaths) { + for (const auto& multikeyComponents : multikeyPaths) { ss << "[ "; - for (const auto multikeyComponent : multikeyComponents) { + for (const auto& multikeyComponent : multikeyComponents) { ss << multikeyComponent << " "; } ss << "] "; diff --git a/src/mongo/db/index/wildcard_key_generator.cpp b/src/mongo/db/index/wildcard_key_generator.cpp index 3a1055c7357..6c9b1305e1b 100644 --- a/src/mongo/db/index/wildcard_key_generator.cpp +++ b/src/mongo/db/index/wildcard_key_generator.cpp @@ -137,7 +137,7 @@ void WildcardKeyGenerator::_traverseWildcard(SharedBufferFragmentBuilder& pooled KeyStringSet::sequence_type* keys, KeyStringSet::sequence_type* multikeyPaths, boost::optional<RecordId> id) const { - for (const auto elem : obj) { + for (const auto& elem : obj) { // If the element's fieldName contains a ".", fast-path skip it because it's not queryable. if (elem.fieldNameStringData().find('.', 0) != std::string::npos) continue; diff --git a/src/mongo/db/query/explain.cpp b/src/mongo/db/query/explain.cpp index 255a1fbd4f2..c4be694ad3d 100644 --- a/src/mongo/db/query/explain.cpp +++ b/src/mongo/db/query/explain.cpp @@ -136,12 +136,12 @@ void appendMultikeyPaths(const BSONObj& keyPattern, BSONObjBuilder subMultikeyPaths(bob->subobjStart("multiKeyPaths")); size_t i = 0; - for (const auto keyElem : keyPattern) { + for (const auto& keyElem : keyPattern) { const FieldRef path{keyElem.fieldNameStringData()}; BSONArrayBuilder arrMultikeyComponents( subMultikeyPaths.subarrayStart(keyElem.fieldNameStringData())); - for (const auto multikeyComponent : multikeyPaths[i]) { + for (const auto& multikeyComponent : multikeyPaths[i]) { arrMultikeyComponents.append(path.dottedSubstring(0, multikeyComponent + 1)); } arrMultikeyComponents.doneFast(); diff --git a/src/mongo/db/query/plan_enumerator.cpp b/src/mongo/db/query/plan_enumerator.cpp index 3da66998244..f96173fd382 100644 --- a/src/mongo/db/query/plan_enumerator.cpp +++ b/src/mongo/db/query/plan_enumerator.cpp @@ -1465,7 +1465,7 @@ void PlanEnumerator::assignMultikeySafePredicates( size_t posInIdx = 0; - for (const auto keyElem : thisIndex.keyPattern) { + for (const auto& keyElem : thisIndex.keyPattern) { // Attempt to assign the predicates to 'thisIndex' according to their position in the index // key pattern. for (auto* couldAssignPred : couldAssign) { diff --git a/src/mongo/db/repl/rs_rollback_test.cpp b/src/mongo/db/repl/rs_rollback_test.cpp index 0105bd8b6eb..b785eadeaa5 100644 --- a/src/mongo/db/repl/rs_rollback_test.cpp +++ b/src/mongo/db/repl/rs_rollback_test.cpp @@ -1815,7 +1815,7 @@ TEST_F(RSRollbackTest, RollbackApplyOpsCommand) { UUID uuid, const BSONObj& filter) const override { int numFields = 0; - for (const auto element : filter) { + for (const auto& element : filter) { ++numFields; ASSERT_EQUALS("_id", element.fieldNameStringData()) << filter; } @@ -2502,7 +2502,7 @@ TEST_F(RSRollbackTest, RollbackFetchesTransactionOperationBeforeCommonPoint) { // This unit test does not test transaction table fetches. return {BSONObj(), NamespaceString::kSessionTransactionsTableNamespace}; } - for (const auto element : filter) { + for (const auto& element : filter) { ++numFields; ASSERT_EQUALS("_id", element.fieldNameStringData()) << filter; } diff --git a/src/mongo/db/server_options_helpers.cpp b/src/mongo/db/server_options_helpers.cpp index 4dcffc0357f..7f7e1fe6ee2 100644 --- a/src/mongo/db/server_options_helpers.cpp +++ b/src/mongo/db/server_options_helpers.cpp @@ -154,7 +154,7 @@ Status validateBaseOptions(const moe::Environment& params) { // Must come after registerAllFailPointsAsServerParameters() above. const auto& spMap = ServerParameterSet::getGlobal()->getMap(); - for (const auto setParam : parameters) { + for (const auto& setParam : parameters) { const auto it = spMap.find(setParam.first); if (it == spMap.end()) { diff --git a/src/mongo/db/storage/bson_collection_catalog_entry.cpp b/src/mongo/db/storage/bson_collection_catalog_entry.cpp index 1cf0ed5b6a1..90710aab127 100644 --- a/src/mongo/db/storage/bson_collection_catalog_entry.cpp +++ b/src/mongo/db/storage/bson_collection_catalog_entry.cpp @@ -57,7 +57,7 @@ void appendMultikeyPathsAsBytes(BSONObj keyPattern, char multikeyPathsEncodedAsBytes[kMaxKeyPatternPathLength]; size_t i = 0; - for (const auto keyElem : keyPattern) { + for (const auto& keyElem : keyPattern) { StringData keyName = keyElem.fieldNameStringData(); size_t numParts = FieldRef{keyName}.numParts(); invariant(numParts > 0); diff --git a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_radix_store.h b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_radix_store.h index d826b56d1ad..2290fab8b8d 100644 --- a/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_radix_store.h +++ b/src/mongo/db/storage/ephemeral_for_test/ephemeral_for_test_radix_store.h @@ -2110,7 +2110,7 @@ private: other._root = _makeHead(otherNode); // Merges insertions and updates from the master tree into the working tree, if possible. - for (const value_type otherVal : other) { + for (const value_type& otherVal : other) { RadixStore::const_iterator baseIter = base.find(otherVal.first); RadixStore::const_iterator thisIter = node.find(otherVal.first); @@ -2148,7 +2148,7 @@ private: } // Perform deletions from the master tree in the working tree, if possible. - for (const value_type baseVal : base) { + for (const value_type& baseVal : base) { RadixStore::const_iterator otherIter = other.find(baseVal.first); RadixStore::const_iterator thisIter = node.find(baseVal.first); @@ -2176,7 +2176,7 @@ private: node._root = _makeHead(current); other._root = _makeHead(otherNode); - for (const value_type otherVal : other) { + for (const value_type& otherVal : other) { RadixStore::const_iterator thisIter = node.find(otherVal.first); if (thisIter != node.end()) diff --git a/src/mongo/db/storage/kv/durable_catalog_test.cpp b/src/mongo/db/storage/kv/durable_catalog_test.cpp index 47ff2e01141..1bbc54bb659 100644 --- a/src/mongo/db/storage/kv/durable_catalog_test.cpp +++ b/src/mongo/db/storage/kv/durable_catalog_test.cpp @@ -147,9 +147,9 @@ private: std::stringstream ss; ss << "[ "; - for (const auto multikeyComponents : multikeyPaths) { + for (const auto& multikeyComponents : multikeyPaths) { ss << "[ "; - for (const auto multikeyComponent : multikeyComponents) { + for (const auto& multikeyComponent : multikeyComponents) { ss << multikeyComponent << " "; } ss << "] "; diff --git a/src/mongo/db/update/addtoset_node.h b/src/mongo/db/update/addtoset_node.h index 240cf3b3484..e2782e5398d 100644 --- a/src/mongo/db/update/addtoset_node.h +++ b/src/mongo/db/update/addtoset_node.h @@ -78,7 +78,7 @@ private: BSONObjBuilder subBuilder(bob.subobjStart("")); { BSONObjBuilder eachBuilder(subBuilder.subarrayStart("$each")); - for (const auto element : _elements) + for (const auto& element : _elements) eachBuilder << element; } } diff --git a/src/mongo/db/update/bit_node.h b/src/mongo/db/update/bit_node.h index a81b98ee5b5..8438e72b89f 100644 --- a/src/mongo/db/update/bit_node.h +++ b/src/mongo/db/update/bit_node.h @@ -72,7 +72,7 @@ private: BSONObjBuilder bob; { BSONObjBuilder subBuilder(bob.subobjStart("")); - for (const auto [bitOperator, operand] : _opList) { + for (const auto& [bitOperator, operand] : _opList) { operand.toBSON( [](SafeNum (SafeNum::*bitOperator)(const SafeNum&) const) { if (bitOperator == &SafeNum::bitAnd) diff --git a/src/mongo/db/update/pullall_node.cpp b/src/mongo/db/update/pullall_node.cpp index e6e9e4570cd..3890dd854d3 100644 --- a/src/mongo/db/update/pullall_node.cpp +++ b/src/mongo/db/update/pullall_node.cpp @@ -63,7 +63,7 @@ private: BSONObjBuilder bob; { BSONArrayBuilder subarrayBuilder(bob.subarrayStart("")); - for (const auto element : _elementsToMatch) + for (const auto& element : _elementsToMatch) subarrayBuilder << element; } return bob.obj(); diff --git a/src/mongo/db/update/push_node.cpp b/src/mongo/db/update/push_node.cpp index 93769c666f3..46b44daa01a 100644 --- a/src/mongo/db/update/push_node.cpp +++ b/src/mongo/db/update/push_node.cpp @@ -209,7 +209,7 @@ BSONObj PushNode::operatorValue() const { // This serialization function always produces $each regardless of whether the input // contained it. BSONObjBuilder eachBuilder(subBuilder.subarrayStart("$each")); - for (const auto value : _valuesToPush) + for (const auto& value : _valuesToPush) eachBuilder << value; } if (_slice) |