[cfe-users] Building clang's static analyzer on Windows

Anton Yartsev anton.yartsev at gmail.com
Wed Jul 29 02:24:06 PDT 2015

Hi Christian,

Unfortunately I'm limited to only e-mails now but I'll try to assist you.
First of all, you don't need to build the static analyser separately.
Static analyser is a part of clang executable. To evaluate the
analyser over a single file or a set of files you just need to run the
clang.exe with the --analyze option (explore output from "clang -help"
for additional analyser options). Typical example:
clang.exe -cc1 -analyzer-checker=core,unix.Malloc -analyze test.cpp
I've sent you two versions of clang executables for windows one
compiled with MinGW, other with VS, did you received them?

If you want to evaluate the static analyser over a make project you
also need the scan-build, ccc-analyser and c++-analyzer perl scripts.
You can get them from the repository if they are missing in Windows
distributions. ccc-analyser.bat and c++-analyzer.bat scripts may also
be helpful in running the analyser under Windows. You obviously need
Perl to be installed to run analyser scripts. scan-build script has
several command-line options, you may check them simply running ''perl
scan-build". --use-analyzer=[path to clang executable] is the one you
exactly need.
There is a site devoted to the analyser:
http://clang-analyzer.llvm.org, check it for additional information.

On 7/14/15, christian.soltenborn at connext.de
<christian.soltenborn at connext.de> wrote:
> Hi once more,
> ok, this is my final attempt to get some feedback. In the meantime, I have
> performed another try to build clang plus tooling, this time following the
> official documentation at http://clang.llvm.org/get_started.html - however,
> CMake fails due to several missing include files (due to the lack of any
> response on this mailing list, I save you and me the time of adding the
> error log to my mail). I have also discovered http://llvm.org/releases/ ,
> where Windows distributions are available, but they do not seem to contain
> the static analyzer at all. I'm tempted to think that building the static
> analyzer on Windows is not possible or at least very difficult - otherwise,
> why should it be missing in the official distributions?
> Therefore, my last question (which is probably mostly directed to the
> moderators of this list) is: Am I asking at the right place? I chose this
> mailing list since I do not want to develop the static analyzer, I just want
> to use it...
> All the best
> Christian

Kind regards,
Yartsev Anton

More information about the cfe-users mailing list