Clang-Tidy slow with dependencies

1.2k Views Asked by At

I am using clang-tidy to lint my code base, but the entire process is very slow. Is there a way to completely ignore header files and not only suppress the warnings? As you can see with this example, a ton of warnings are coming from my project dependencies:

Suppressed 72958 warnings (72958 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
1

There are 1 best solutions below

0
irowe On

I don't think there's a good way to avoid processing the headers at all, since clang-tidy needs to build the abstract syntax tree in order to run the static analyzer checks. That's just how LLVM's LibTooling (what clang-tidy is built with) works. See this answer as well.

If speed is the problem (and you have multiple processor cores at your disposal), you can use run-clang-tidy.py, which runs checks for each file in your compilation database in parallel.