[cfe-dev] Clang Static Analyzer -need some explanation

David Blaikie dblaikie at gmail.com
Tue Jul 15 08:14:14 PDT 2014


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.

On Mon, Jul 14, 2014 at 8:31 PM, Sandeep K Chaudhary
<babbusandy2006 at gmail.com> wrote:
> 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.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



More information about the cfe-dev mailing list