llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.25k stars 12.08k forks source link

Incremental analyzing with clang-tidy #64615

Open maldag opened 1 year ago

maldag commented 1 year ago

I would like to use clang-tidy to check a bigger repository. Is there a way to speed things up using older results of clang-tidy? A naive approach would only check changed files in git, but this does obviously not work due to includes in other files etc.

llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-tidy

PiotrZSL commented 1 year ago

Easiest way (what I do) is to run clang preprocessor before, and create cache. Other option is to enable dependency files generation (require modification of libClangTools) and use clang-tidy with a wrapper as an "compiler". Next option would be to use cmake that has some support for clang-tidy.

But short answer, is not easy but possible.

maldag commented 1 year ago

Thanks for the quick reply. Would you share a small example of how you do things?

firewave commented 1 year ago

There's an (unmaintained) project which tries to achieve that: https://github.com/ejfitzgerald/clang-tidy-cache

I gave it a small spin once but didn't have time to actually look into how well it actually works.

maldag commented 1 year ago

Maybe this https://pypi.org/project/codechecker/ could also be looked at?