Issues:
Almost all checks currently match statements and prepare diagnostic information for issues that are in system headers only to be thrown away at the end due to lack --system-headers.
Example:
-
without unless(isExpansionInSystemHeader())
47.4298 ( 12.6%) 13.7315 ( 12.9%) 61.1614 ( 12.7%) 61.1402 ( 12.7%) readability-identifier-naming -
with unless(isExpansionInSystemHeader())
23.7770 ( 7.6%) 9.3479 ( 8.1%) 33.1249 ( 7.8%) 33.1096 ( 7.8%) readability-identifier-naming
This is caused by complicated logic of check that hit performance in the files that end users is not interested in.
Proposed solution:
- add some matcher function and free standing function to check if diagnostic will be excluded on ClangTidyCheck level and use it in checks.
Something like āfunctionDecl(unlessExcluded())ā or this->isExcluded(MatchedDecl->getLocation())
Bigger projects could see significant performance boost. This could be also extended to take into account also --header-filter.
For example this is list of all warnings generated (from system files) in project I work for:
494615 modernize-use-nullptr
509163 modernize-use-auto
521390 modernize-use-override
756136 readability-implicit-bool-conversion
1067033 cppcoreguidelines-pro-bounds-pointer-arithmetic
1076988 modernize-avoid-c-arrays
1098023 cppcoreguidelines-special-member-functions
1376238 google-explicit-constructor
3072423 modernize-use-noexcept
6371033 readability-braces-around-statements
11445644 modernize-use-using
34328178 cppcoreguidelines-macro-usage
96856838 bugprone-reserved-identifier
97458338 readability-identifier-naming
For those few checks its already a quarter of trillion issues that are generated and thrown away.
Raising as requested here: ā D143851 [clang-tidy] Tweak 'rule of 3/5' checks to allow defaulting a destructor outside the class.
@njames93