Hi!
I’m interested in adding a number of checks to clang-tidy that detect redundant usages of static
in C++ and automatically remove them via fix-it. Examples that I have in mind:
-
static
definition in anonymous namespace. -
static inline
. -
static const
/constexpr
at global scope. - Other suggestions?
The first use case already exists in readability-static-definition-in-anonymous-namespace
.
I’m asking for advice on what the best way forward is to implement these checks:
- Implement N checks, one for each use case.
- Implement 1 large check, with N configuration options to enable/disable the different use cases. This would involve deprecating the
readability-static-definition-in-anonymous-namespace
check.
I’m slightly in favor of the latter, since I can foresee quite some code duplication otherwise (matchers will be very similar). I also wonder if having N checks would hurt performance. On the other hand it’s nice to keep each check having a single responsibility.
What do you think would be the best way forward?
Thanks!