Building clang-tidy

Dear community,

Are there any instructions specifically on how to build clang-tidy? I’ve downloaded LLVM, Clang and Clang Extras, run cmake, but can’t get clang-tidy to build. I’ve put clang extras in tools\clang\tools\extra, and run cmake with the command:

cmake -G “Visual Studio 15 Win64” …

Everything up to this point is fine. Clang builds and runs just fine. But when I try to compile clang-tidy, I get this error:

Cannot open include file: ‘clang/Tooling/Core/Diagnostic.h’: No such file or directory (tools\clang\tools\extra\clang-tidy\ClangTidyDiagnosticConsumer.h)

Searching, I can’t find this file or this Core directory. My clang version is version 3.9.0 (tags/RELEASE_390/final).

Any ideas why it doesn’t compile?

Patrik Eklöf

It looks to me like you are mismatching your sources. You have clang 3.9, but a much more recent clang-tools-extra checkout. The missing header was added in January, so it is not present in the 3.9 release.


That was indeed the case.

I cannot believe I simply read the instructions, do this, do that, without considering that I was on a different branch.

Thank you for the answer. I appreciate it.

Patrik Eklöf