[all-commits] [llvm/llvm-project] fc1f75: [clang-tidy] Add `readability-redundant-nested-if`...

Daniil Dudkin via All-commits all-commits at lists.llvm.org
Tue Jun 9 14:13:28 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fc1f754c397b6a1d3e5c7199db81191ec9335faf
      https://github.com/llvm/llvm-project/commit/fc1f754c397b6a1d3e5c7199db81191ec9335faf
  Author: Daniil Dudkin <unterumarmung at yandex.ru>
  Date:   2026-06-09 (Tue, 09 Jun 2026)

  Changed paths:
    M clang-tools-extra/clang-tidy/readability/CMakeLists.txt
    M clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
    A clang-tools-extra/clang-tidy/readability/RedundantNestedIfCheck.cpp
    A clang-tools-extra/clang-tidy/readability/RedundantNestedIfCheck.h
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/docs/clang-tidy/checks/list.rst
    A clang-tools-extra/docs/clang-tidy/checks/readability/redundant-nested-if.rst
    A clang-tools-extra/test/clang-tidy/checkers/readability/Inputs/redundant-nested-if/common.h
    A clang-tools-extra/test/clang-tidy/checkers/readability/redundant-nested-if-allow-bool-conversion.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/redundant-nested-if-cxx17-allow-bool-conversion.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/redundant-nested-if-cxx17.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/redundant-nested-if-cxx20.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/redundant-nested-if-cxx23.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/redundant-nested-if-cxx26.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/redundant-nested-if-notes.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/redundant-nested-if.cpp

  Log Message:
  -----------
  [clang-tidy] Add `readability-redundant-nested-if` check (#181558)

Introduce a readability check that merges nested `if`/`if constexpr`
chains by combining conditions with `&&`.

This resurrects the earlier patch at https://reviews.llvm.org/D130630.

The implementation keeps fix-its conservative around macros,
preprocessor directives, attributes, user-defined bool conversions, and
comment placement in removable nested headers. It also supports C++17
declaration conditions by rewriting them into init-statement form when
safe.

Assisted by Codex in writing tests and some of the code.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list