[all-commits] [llvm/llvm-project] 59b39c: [clang-tidy] Add new check: `readability-use-conci...

Victor Chernyakin via All-commits all-commits at lists.llvm.org
Sun Jul 13 09:23:48 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 59b39c0031eded7c46e554b161382187cb2d0ca5
      https://github.com/llvm/llvm-project/commit/59b39c0031eded7c46e554b161382187cb2d0ca5
  Author: Victor Chernyakin <chernyakin.victor.j at outlook.com>
  Date:   2025-07-13 (Sun, 13 Jul 2025)

  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/UseConcisePreprocessorDirectivesCheck.cpp
    A clang-tools-extra/clang-tidy/readability/UseConcisePreprocessorDirectivesCheck.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/use-concise-preprocessor-directives.rst
    A clang-tools-extra/test/clang-tidy/checkers/readability/use-concise-preprocessor-directives.cpp

  Log Message:
  -----------
  [clang-tidy] Add new check: `readability-use-concise-preprocessor-directives` (#146830)

Closes #132561.

This is a check that rewrites `#if`s and `#elif`s like so:

```cpp
#if  defined(MEOW) // -> #ifdef  MEOW
#if !defined(MEOW) // -> #ifndef MEOW
```

And, since C23 and C++23:

```cpp
#elif  defined(MEOW) // -> #elifdef  MEOW
#elif !defined(MEOW) // -> #elifndef MEOW
```



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