Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update clang-tidy to include some more recent rules.. #4003

Conversation

hzeller
Copy link
Collaborator

@hzeller hzeller commented Nov 8, 2024

Also add the run-clang-tidy-cached.cc script (which is in c++ for ease of maintenance) which allows to cache the output, so reprocessing files is much faster.


The cache script can be found on https://github.com/hzeller/dev-tools and is essentially just a non-modified drop-in here (except the configuration in line 118 that says to start searching in src/)

I've not removed the old run-clang-tidy.sh script, as it has the functionality to run with a "limited" set of rules.

While at it , update the .clang-tidy rules to include some more wildcards, but also remove an old option that does not work anymore with current clang-tidy.

Due to the caching, only changed files will be re-processed, and if there are no changes, the output is essentially instant. When it processes files, it uses all cores on the machine.

The script is written in C++, but it self-compiles, so with the executable bit flag set, it can be invoked directly like this:

$ .github/bin/run-clang-tidy-cached.cc
Cache dir "~/.cache/clang-tidy/Surelog_v18_ae752712"
136 files of interest.
Details: Surelog_clang-tidy.out
Summary: Surelog_clang-tidy.summary
---- Summary ----
 2854 [misc-include-cleaner]
   54 [modernize-use-default-member-init]
   46 [readability-redundant-casting]
   20 [misc-non-private-member-variables-in-classes]
   19 [modernize-use-nullptr]
   17 [modernize-use-using]
   14 [clang-diagnostic-error]
   14 [modernize-use-bool-literals]
   13 [bugprone-assignment-in-if-condition]
   11 [clang-analyzer-deadcode.DeadStores]
   11 [clang-diagnostic-unused-but-set-variable]
   11 [modernize-avoid-c-arrays]
   10 [bugprone-unused-local-non-trivial-variable]
   10 [modernize-use-equals-default]
    9 [modernize-return-braced-init-list]
    8 [modernize-use-emplace]
    6 [readability-redundant-inline-specifier]
    5 [misc-unused-using-decls]
    4 [bugprone-signed-char-misuse]
    4 [misc-header-include-cycle]
    4 [modernize-deprecated-headers]
    3 [readability-avoid-unconditional-preprocessor-if]
    2 [bugprone-implicit-widening-of-multiplication-result]
    2 [clang-analyzer-core.NonNullParamChecker]
    2 [clang-analyzer-optin.core.EnumCastOutOfRange]
    2 [clang-analyzer-optin.cplusplus.VirtualCall]
    2 [readability-container-data-pointer]
    1 [bugprone-switch-missing-default-case]
    1 [clang-diagnostic-unneeded-internal-declaration]
    1 [clang-tidy-nolint]
    1 [modernize-make-unique]
    1 [performance-enum-size]
    1 [performance-inefficient-string-concatenation]
    1 [performance-inefficient-vector-operation]
    1 [performance-unnecessary-value-param]

(alternatively , it can be invoked with a shell like so: sh .github/bin/run-clang-tidy-cached.cc)

Also add the run-clang-tidy-cached.cc script (which is in c++
for ease of maintenance) which allows to cache the output, so reprocessing
files is much faster.
@hzeller hzeller requested a review from alaindargelas November 8, 2024 04:46
@alaindargelas
Copy link
Collaborator

Lgtm

@alaindargelas alaindargelas merged commit ed9497d into chipsalliance:master Nov 8, 2024
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants