[cfe-dev] [clang-tidy][RFC] Run each check only once
Carlos Galvez via cfe-dev
cfe-dev at lists.llvm.org
Mon Sep 27 04:50:11 PDT 2021
Hi!
I'm writing to this list as suggested in this bug:
https://reviews.llvm.org/D72566
Background
=========
clang-tidy has implemented a number of checks, some of which are *aliases* of
"real" checks. Currently if a user specifies that they want to run both the
"real" and the "alias" check, clang-tidy will run the same check twice. Or
N times if there are N aliases.
When applying clang-tidy to large codebases, this can have a severe impact
in runtime in Continuous Integration checks. The only solution so far is to
manually disable alias checks, but this generates noise in the config file,
and is error-prone and cumbersome to maintain in the future, as one always
need to check the LLVM docs to see what is aliasing what.
I have read in different bugs that one tricky problem with this is that
"some alias checks run with different defaults, therefore leading to
different results". I would be interested to know which checks are these
and where this different default configuration is documented. I would argue
that if 2 checks run different things and produce different results, then
they are not aliases. They may share the same implementation, but they are
not identical (therefore cannot be called "aliases".
I have also read the argument "people should not enable all checks". I
believe that should be up to users to decide. Plus, as we've seen, there
are aliases even within the same category, e.g. "cert-*", so the problem
still remains.
Proposal
=======
- Find which checks are "fake aliases", if any - share the same
implementation but run with different defaults and produce different
results. Change these checks to not be considered as "aliases".
- Add an opt-in feature (command line, config) to enable "the same check
should be run only once". Diagnostics should come only from the "main"
check (if it's active) or from the "alias" check (if the "main" check is
not active).
Let me know what you think! I'm a total newby to LLVM but I'm happy to
contribute in any way I can :)
Thanks!
/Carlos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210927/6f8cc3ab/attachment.html>
More information about the cfe-dev
mailing list