diff --git a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp --- a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp @@ -228,7 +228,8 @@ if (!S) return false; if (isa(S) || isa(S) || isa(S) || - isa(S) || isa(S)) + isa(S) || isa(S) || + isa(S)) return true; if (isa(S) || isa(S) || isUnaryLogicalNotOperator(S) || diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -196,6 +196,11 @@ ` check to emit proper warnings when a type forward declaration precedes its definition. +- Improved :doc:`readability-implicit-bool-conversion + ` check to take do-while loops into + account for the ``AllowIntegerConditions`` and ``AllowPointerConditions`` + options. + Removed checks ^^^^^^^^^^^^^^ diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion-allow-in-conditions.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion-allow-in-conditions.cpp --- a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion-allow-in-conditions.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion-allow-in-conditions.cpp @@ -38,6 +38,9 @@ while (functionReturningInt()) {} while (functionReturningPointer()) {} while (functionReturningInt() && !functionReturningPointer() || (!functionReturningInt() && functionReturningPointer())) {} + do {} while (functionReturningInt()); + do {} while (functionReturningPointer()); + do {} while (functionReturningInt() && !functionReturningPointer() || (!functionReturningInt() && functionReturningPointer())); int value1 = functionReturningInt() ? 1 : 2; int value2 = !functionReturningInt() ? 1 : 2; int value3 = (functionReturningInt() && functionReturningPointer() || !functionReturningInt()) ? 1 : 2;