[clang-tools-extra] [clang-tidy] Add `readability-redundant-nested-if` check (PR #181558)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Sat May 30 20:54:29 PDT 2026


================
@@ -0,0 +1,37 @@
+// RUN: %check_clang_tidy -check-suffixes=ALLOWBOOL -std=c++98-or-later %s readability-redundant-nested-if %t -- -config='{CheckOptions: {readability-redundant-nested-if.AllowUserDefinedBoolConversion: true}}' -- -fno-delayed-template-parsing
+
+
+bool cond(int X = 0);
+int side_effect();
+void sink();
+void bar();
+
+struct BoolLike {
+  operator bool() const;
+};
+
+BoolLike make_bool_like();
+
+#define INNER_IF(C) if (C) sink()
+#define COND_MACRO cond()
+#define OUTER_IF if (cond())
----------------
vbvictor wrote:

Duplicate code can be placed in per-check test include (see include directories with check names).

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


More information about the cfe-commits mailing list