Clang Static Analyzer -need some explanation

Hi Guys,

Can someone please explain how the ‘Clang Static Analyzer’ works by over-riding the CC and CXX variables?

A pointer to some documentation would also be great. I looked the [1] but didn’t find any explanation about how exactly it works by over-riding variables without knowing anything about the build process or makefile.

In the meanwhile I am reading the code of ‘scan-build’ and ‘ccc-analyzer’ but it’s not so simple, and also it’s written in Perl with which I don’t have any experience. Therefore, some explanation would be of great help.

[1] http://clang-analyzer.llvm.org/index.html

Thanks and regards,
Sandeep.

I believe the basic idea is that scan-build executes the command you
give it (eg: "scan-build make") and modifies the environment so CC and
CXX resolve to special wrappers that scan-build provides, the wrapper
executes both the static analysis and the real compilation of the
source.

So, as long as you have a build system which has a single command-line
entry point (like make) and uses the CC and CXX environment variables
to find the compilers to use, scan-build can proxy the build and
perform static analysis on the project in the course of a normal (if
slow) build.