[clang-tools-extra] [clang-tidy] Add new check `llvm-prefer-static-over-anonymous-namespace` (PR #142839)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 20 09:35:09 PDT 2025


vbvictor wrote:

> Generalizing this check to enforce either static or anonymous namespaces would be great

There is a check [misc-use-anonymous-namespace](https://clang.llvm.org/extra/clang-tidy/checks/misc/use-anonymous-namespace.html) that suggests converting `static` to anon namespace, so I think It's not worth generalizing.

We can make an alias, but, again, there is a `misc-` check that suggests doing literally the opposite. To not make people confused, I placed it only in `llvm-`.

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


More information about the cfe-commits mailing list