SERVER-90552 Add bugprone-string-constructor to clang-tidy. (#22235)

GitOrigin-RevId: 96b251cd5235d5522c455f8fa53d3d0de36de218
This commit is contained in:
Brad Cater 2024-05-16 16:16:08 -04:00 committed by MongoDB Bot
parent 1401612a99
commit c3ee3fe6f7
2 changed files with 8 additions and 6 deletions

View File

@ -20,6 +20,7 @@ Checks: '-*,
bugprone-multiple-statement-macro,
bugprone-parent-virtual-call,
bugprone-sizeof-container,
bugprone-string-constructor,
bugprone-string-integer-assignment,
bugprone-suspicious-enum-usage,
bugprone-suspicious-memset-usage,
@ -77,7 +78,6 @@ Checks: '-*,
-bugprone-move-forwarding-reference,
-bugprone-narrowing-conversions,
-bugprone-sizeof-expression,
-bugprone-string-constructor,
-bugprone-string-literal-with-embedded-nul,
-bugprone-suspicious-missing-comma,
-bugprone-undefined-memory-manipulation,
@ -137,17 +137,19 @@ HeaderFilterRegex: '(mongo/.*|@MONGO_BUILD_DIR@/.*)'
CheckOptions:
- key: bugprone-assert-side-effect.AssertMacros
value: assert
- key: mongo-header-bracket-check.mongoSourceDirs
value: 'src/mongo;@MONGO_BUILD_DIR@'
- key: mongo-collection-sharding-runtime-check.exceptionDirs
value: 'src/mongo/db/s'
- key: bugprone-assert-side-effect.CheckFunctionCalls
value: '0'
- key: bugprone-dangling-handle.HandleClasses
value: 'std::basic_string_view;std::experimental::basic_string_view'
- key: bugprone-string-constructor.WarnOnLargeLength
value: '0'
- key: bugprone-suspicious-enum-usage.StrictMode
value: '0'
- key: modernize-replace-auto-ptr.IncludeStyle
value: llvm
- key: modernize-replace-random-shuffle.IncludeStyle
value: llvm
- key: mongo-collection-sharding-runtime-check.exceptionDirs
value: 'src/mongo/db/s'
- key: mongo-header-bracket-check.mongoSourceDirs
value: 'src/mongo;@MONGO_BUILD_DIR@'

View File

@ -73,7 +73,7 @@ namespace mongo {
namespace {
template <typename T>
std::string debugPrint(const T* sbeElement) {
return sbeElement ? sbe::DebugPrinter{}.print(sbeElement->debugPrint()) : nullptr;
return sbeElement ? sbe::DebugPrinter{}.print(sbeElement->debugPrint()) : std::string();
}
const NamespaceString kNss = NamespaceString::createNamespaceString_forTest("test.bm");