[clang-tools-extra] [clang-tidy] Correcting fix suggestion in `readability-simplify-boolean-expr` (PR #178392)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 5 23:46:47 PST 2026


=?utf-8?q?Björn?= Svensson <bjorn.a.svensson at est.tech>,
=?utf-8?q?Björn?= Svensson <bjorn.a.svensson at est.tech>,
=?utf-8?q?Björn?= Svensson <bjorn.a.svensson at est.tech>,
=?utf-8?q?Björn?= Svensson <bjorn.a.svensson at est.tech>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/178392 at github.com>


================
@@ -0,0 +1,792 @@
+// RUN: %check_clang_tidy -std=c23-or-later %s readability-simplify-boolean-expr %t
+
+bool a1 = false;
+
+void if_with_bool_literal_condition() {
+  int i = 0;
+  if (false) {
+    i = 1;
+  } else {
+    i = 2;
+  }
+  i = 3;
+  // CHECK-MESSAGES: :[[@LINE-6]]:7: warning: {{.*}} in if statement condition
+  // CHECK-FIXES:      {{^  int i = 0;$}}
----------------
vbvictor wrote:

Also, ideally match whole lines without `{{` here and later, but as I see other tests of boolean-expr so It's okay.

https://github.com/llvm/llvm-project/pull/178392


More information about the cfe-commits mailing list