SERVER-90534 Add bugprone-sizeof-container to clang-tidy checks. (#22216)

GitOrigin-RevId: 055d326abe672924cb5ec5b2e386b7e9a37a0f53
This commit is contained in:
Brad Cater 2024-05-15 17:46:11 -04:00 committed by MongoDB Bot
parent 4a42da3c39
commit b8a56c98af
3 changed files with 4 additions and 4 deletions

View File

@ -19,6 +19,7 @@ Checks: '-*,
bugprone-misplaced-widening-cast, bugprone-misplaced-widening-cast,
bugprone-multiple-statement-macro, bugprone-multiple-statement-macro,
bugprone-parent-virtual-call, bugprone-parent-virtual-call,
bugprone-sizeof-container,
bugprone-string-integer-assignment, bugprone-string-integer-assignment,
bugprone-suspicious-enum-usage, bugprone-suspicious-enum-usage,
bugprone-suspicious-memset-usage, bugprone-suspicious-memset-usage,
@ -74,7 +75,6 @@ Checks: '-*,
-bugprone-macro-parentheses, -bugprone-macro-parentheses,
-bugprone-move-forwarding-reference, -bugprone-move-forwarding-reference,
-bugprone-narrowing-conversions, -bugprone-narrowing-conversions,
-bugprone-sizeof-container,
-bugprone-sizeof-expression, -bugprone-sizeof-expression,
-bugprone-string-constructor, -bugprone-string-constructor,
-bugprone-string-literal-with-embedded-nul, -bugprone-string-literal-with-embedded-nul,

View File

@ -212,7 +212,7 @@ size_t FTSQueryImpl::getApproximateSize() const {
auto computeVectorSize = [](const std::vector<std::string>& v) { auto computeVectorSize = [](const std::vector<std::string>& v) {
size_t size = 0; size_t size = 0;
for (const auto& str : v) { for (const auto& str : v) {
size += sizeof(str) + str.size() + 1; size += sizeof(std::string) + str.size() + 1;
} }
return size; return size;
}; };
@ -220,7 +220,7 @@ size_t FTSQueryImpl::getApproximateSize() const {
auto computeSetSize = [](const std::set<std::string>& s) { auto computeSetSize = [](const std::set<std::string>& s) {
size_t size = 0; size_t size = 0;
for (const auto& str : s) { for (const auto& str : s) {
size += sizeof(str) + str.size() + 1; size += sizeof(std::string) + str.size() + 1;
} }
return size; return size;
}; };

View File

@ -526,7 +526,7 @@ size_t FTSSpec::getApproximateSize() const {
auto computeVectorSize = [](const std::vector<std::string>& v) { auto computeVectorSize = [](const std::vector<std::string>& v) {
size_t size = 0; size_t size = 0;
for (const auto& str : v) { for (const auto& str : v) {
size += sizeof(str) + str.size() + 1; size += sizeof(std::string) + str.size() + 1;
} }
return size; return size;
}; };