diff --git a/.clang-tidy.in b/.clang-tidy.in index cd81765536e..cb84d1db245 100644 --- a/.clang-tidy.in +++ b/.clang-tidy.in @@ -19,6 +19,7 @@ Checks: '-*, bugprone-misplaced-widening-cast, bugprone-multiple-statement-macro, bugprone-parent-virtual-call, + bugprone-sizeof-container, bugprone-string-integer-assignment, bugprone-suspicious-enum-usage, bugprone-suspicious-memset-usage, @@ -74,7 +75,6 @@ Checks: '-*, -bugprone-macro-parentheses, -bugprone-move-forwarding-reference, -bugprone-narrowing-conversions, - -bugprone-sizeof-container, -bugprone-sizeof-expression, -bugprone-string-constructor, -bugprone-string-literal-with-embedded-nul, diff --git a/src/mongo/db/fts/fts_query_impl.cpp b/src/mongo/db/fts/fts_query_impl.cpp index 6c081d145e4..3b449eaf8db 100644 --- a/src/mongo/db/fts/fts_query_impl.cpp +++ b/src/mongo/db/fts/fts_query_impl.cpp @@ -212,7 +212,7 @@ size_t FTSQueryImpl::getApproximateSize() const { auto computeVectorSize = [](const std::vector& v) { size_t size = 0; for (const auto& str : v) { - size += sizeof(str) + str.size() + 1; + size += sizeof(std::string) + str.size() + 1; } return size; }; @@ -220,7 +220,7 @@ size_t FTSQueryImpl::getApproximateSize() const { auto computeSetSize = [](const std::set& s) { size_t size = 0; for (const auto& str : s) { - size += sizeof(str) + str.size() + 1; + size += sizeof(std::string) + str.size() + 1; } return size; }; diff --git a/src/mongo/db/fts/fts_spec.cpp b/src/mongo/db/fts/fts_spec.cpp index 2ea96a49839..50b96cc6317 100644 --- a/src/mongo/db/fts/fts_spec.cpp +++ b/src/mongo/db/fts/fts_spec.cpp @@ -526,7 +526,7 @@ size_t FTSSpec::getApproximateSize() const { auto computeVectorSize = [](const std::vector& v) { size_t size = 0; for (const auto& str : v) { - size += sizeof(str) + str.size() + 1; + size += sizeof(std::string) + str.size() + 1; } return size; };