[clang-tools-extra] [clang-tidy] Fix readability-simplify-boolean-expr for init statements (PR #172220)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 15 21:57:35 PST 2025
================
@@ -1,19 +0,0 @@
-// RUN: clang-tidy %s -checks='-*,readability-simplify-boolean-expr' -- -std=c++17 | count 0
-struct RAII {};
-bool foo(bool Cond) {
- bool Result;
-
- if (RAII Object; Cond)
- Result = true;
- else
- Result = false;
-
- if (bool X = Cond; X)
- Result = true;
- else
- Result = false;
-
- if (bool X = Cond; X)
- return true;
- return false;
-}
----------------
Anshul200677 wrote:
@vbvictor Thanks for the feedback!
Documentation: I've updated simplify-boolean-expr.rst with a note clarifying that C++17 initialization statements are now properly handled.
Test Coverage: I restored the logic from the deleted tests (including the RAII and complex condition cases) into simplify-boolean-expr.cpp. I verified that they now pass correctly without crashing or false positives.
https://github.com/llvm/llvm-project/pull/172220
More information about the cfe-commits
mailing list