This revision was automatically updated to reflect the committed changes. Closed by commit rG33e212954430: [clang-tidy] Initialize boolean variables with `false` in cppcoreguidelines… (authored by SimplyDanny).
Changed prior to commit: https://reviews.llvm.org/D129420?vs=443429&id=443434#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D129420/new/ https://reviews.llvm.org/D129420 Files: clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp clang-tools-extra/docs/ReleaseNotes.rst clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp +++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp @@ -64,7 +64,7 @@ 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; Index: clang-tools-extra/docs/ReleaseNotes.rst =================================================================== --- clang-tools-extra/docs/ReleaseNotes.rst +++ clang-tools-extra/docs/ReleaseNotes.rst @@ -247,6 +247,10 @@ <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 ^^^^^^^^^^^^^^ Index: clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp +++ clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp @@ -84,6 +84,8 @@ if (TypePtr->isEnumeralType()) InitializationString = nullptr; + else if (TypePtr->isBooleanType()) + InitializationString = " = false"; else if (TypePtr->isIntegerType()) InitializationString = " = 0"; else if (TypePtr->isFloatingType()) {
Index: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp =================================================================== --- clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp +++ clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp @@ -64,7 +64,7 @@ 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; Index: clang-tools-extra/docs/ReleaseNotes.rst =================================================================== --- clang-tools-extra/docs/ReleaseNotes.rst +++ clang-tools-extra/docs/ReleaseNotes.rst @@ -247,6 +247,10 @@ <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 ^^^^^^^^^^^^^^ Index: clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp =================================================================== --- clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp +++ clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp @@ -84,6 +84,8 @@ if (TypePtr->isEnumeralType()) InitializationString = nullptr; + else if (TypePtr->isBooleanType()) + InitializationString = " = false"; else if (TypePtr->isIntegerType()) InitializationString = " = 0"; else if (TypePtr->isFloatingType()) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits