[clang-tools-extra] [clang-tidy] new check readability-mark-static (PR #90830)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Thu May 2 02:15:34 PDT 2024


https://github.com/PiotrZSL requested changes to this pull request.

1. Wrong check name, maybe readability-unessesary-external-linkage or something, maybe it should even be an performance check [as there it will bring more benefits] (current check suggest more an "static methods").
2. Add support for unity builds (.cpp files included from single .cpp file = isInMainFile is not sufficient)
3. Diagnostic need to be more detailed
4. When I run into these issues, i got questions from developers why not use anonymous namespaces (maybe it could be configurable, or finall check restrict only to static [I prefer static])

Additionally when those issues were being fixed in project, there were lot of situations where there were forward declaration in header file, but developer forget to include header file in .cpp, this is why diagnostic need to be more detailed, so developer could find issue, instead of adding static.

In summary, my main concern is check name & diagnostic, current name is too generic

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


More information about the cfe-commits mailing list