[cfe-dev] Clang Static Analyzer: how to use it for C++ application?

Ted Kremenek kremenek at apple.com
Tue Apr 26 10:59:08 PDT 2011


It looks like the Makefile generated by CMake hardcodes the compiler used.  scan-build tries to override the compiler used by the Makefile to be ccc-analyzer/c++-analyzer respectively.  This coincides with what is stated in the CMake documentation:

http://www.itk.org/Wiki/CMake_Useful_Variables#Compilers_and_Tools

I think the solution is to also run 'cmake' through scan-build as well, similarly to how one handles 'configure' based builds.  That should cause CMake to use ccc-analyzer/c++-analyzer for the compiler.

On Apr 26, 2011, at 2:40 AM, Liang Qi wrote:

> Hi, all,
> 
> I am just a newbie for Clang Static Analyzer. Then my question is not
> that complex for you. I am using checker-256 on a Snow Leopard.
> 
> Here is my test source code, main.cpp: http://pastebin.com/AarMPKbs
> And I have this CMakeLists.txt: http://pastebin.com/4B1e785d
> After "cmake ." to generate Makefile, I called "scan-build" and get
> this output: http://pastebin.com/f0GzQi3m
> 
> Could you give me any hint, for example, how to enable the checker for
> cplusplus.experimental.Iterators?
> 
> Regards,
> Liang
> 
> -- 
> http://www.qiliang.net
> _______________________________________________
> 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