[cfe-dev] [clang-tidy][RFC] Run each check only once

Aaron Ballman via cfe-dev cfe-dev at lists.llvm.org
Sun Oct 3 09:19:40 PDT 2021


On Sun, Oct 3, 2021 at 11:24 AM Aaron Ballman <aaron at aaronballman.com> wrote:
> To date, aliases have been surfaced to the user as a first-class check
> (while the documentation typically redirects to the primary check for
> simplicity of writing check aliases, there's no requirement that they
> do so; other than that, aliases should behave the same as any other
> check as far as the user is concerned.) You're proposing to make
> aliases be sort of second-class checks that are more closely tied to
> the primary check by providing an option that says aliases are
> disabled as a blanket operation rather than a case-by-case basis. I am
> not convinced this is a good approach. We may already have checks for
> which this is a problem (where the aliased check and the primary check
> are checking different things), and this closes off the design space
> for such checks in the future (and possibly encourages less code reuse
> in the process).
>
> Btw, I'm not saying "no way", I'm saying "let's make sure we're not
> regressing functionality or painting ourselves into a corner."

Also, to date I believe we've never really cared which module has the
primary check and which one has the alias check (it's fine for the
primary to be in cert- and the alias to be in bugprone- or vice
versa), but with this sort of an option, that implementation detail is
leaked out to the user in a more obvious way. If we go this route, we
might have to move some checks around so there's some consistent rule
to aid users (like, the general-purpose module holds the primary and
the coding style guidelines get the alias), but it may not work in
every situation (I can imagine a check living in two style guides but
not a general purpose module, or two general purpose modules but not a
style guide).

~Aaron


More information about the cfe-dev mailing list