clang-tools compilation confusion

Hi, I hope this is an easy question. I’ve been stuck with this for longer than I care to admit, so I appreciate any help! I’ve been trying to setup a new C++ project for myself, using all of the clang static analysis tools from the start. I was able to integrate clang-format and clang-check into my workflow no problem, but I’m unable to figure out how to compile the extra tools along-side with my llvm installation.

I followed the steps verbatim from:

Specifically the step asking us to checkout the extra repository, and then build the whole project.

benjamin@benjamin-HP-Compaq-8200-Elite-SFF-PC  ~/github/build-llvm  pwd

cmake -G “Unix Makefiles” -DCMAKE_BUILD_TYPE=Release …/llvm/

This works find, produces a release build of the clang compiler. However, the clang extra tools (such as clang-tidy) are not found in the bin directory. I noticed that clang-tidy came with a python script to run it, which I did, which failed because (I believe) clang-apply-replacements isn’t in my path.

So I went and looked for clang-apply-replacements, and I couldn’t find a python script fronting that, so I figure I need to understand why my clang-apply-replacements binary isn’t being compiled when I build llvm/clang.

Here’s the directory structure of my llvm directory, if that’s at all helpful:

Thanks in advance, I’m super excited about using these tools but the documentation around installing the extra tools is missing a bit of hand-holding I believe. I could be wrong, thanks in advance!!


I think this should be really only about cloning clang-extras into
the right directory. clang-extras should be in: 'llvm/tools/clang/tools/extra'.
I attached a script which clones and builds LLVM with a list of subprojects.
Just comment out the ones you don't need.

-Alex (1.44 KB)