In case of a variable with a built-in boolean type, `false` is a better fit to default-initialize it.
Reviewed By: njames93
Differential Revision: https://reviews.llvm.org/D129420
if (TypePtr->isEnumeralType())
InitializationString = nullptr;
+ else if (TypePtr->isBooleanType())
+ InitializationString = " = false";
else if (TypePtr->isIntegerType())
InitializationString = " = 0";
else if (TypePtr->isFloatingType()) {
<clang-tidy/checks/readability/simplify-boolean-expr>` to simplify expressions
using DeMorgan's Theorem.
+- Made the fix-it of :doc:`cppcoreguidelines-init-variables
+ <clang-tidy/checks/cppcoreguidelines/init-variables>` use ``false`` to initialize
+ boolean variables.
+
Removed checks
^^^^^^^^^^^^^^
bool b;
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: variable 'b' is not initialized [cppcoreguidelines-init-variables]
- // CHECK-FIXES: {{^}} bool b = 0;{{$}}
+ // CHECK-FIXES: {{^}} bool b = false;{{$}}
bool bval = true;
const char *ptr;