[cfe-dev] C++ analysis vs C analysis

Ted Kremenek kremenek at apple.com
Mon Feb 21 11:13:12 PST 2011

It's expected behavior.  C++ analysis support is not enabled by default because it mostly doesn't work and is a major WIP.  If you want to turn it on for scan-build, you will need to set the CCC_ANALYZER_CPLUSPLUS environment variable prior to running scan-build.

On Feb 21, 2011, at 7:57 AM, Jean Baptiste LE STANG wrote:

> Hello,
> I'm trying to use LLVM & scan-build (clang 2.8, checker-255) to
> achieve a static analysis of  a C++ program to detect potential bugs.
> Before doing it on my real program, I've been trying to make it work
> on a simple program :
> int main(int argc, char * argv[] , char * arge[]){
>        int i;
>        if (i<5){
>                i = 50;
>        }
>        return i;
> }
> First case as a C program : scan-build -k -V -v gcc main.c
> ANALYZE: main.c main
> main.c:4:14: warning: The left operand of '<' is a garbage value
>        if (i<5){
> Second case as a C++ program :  scan-build -k -V -v g++ main.cpp and
> i'm missing the previous error detected in scenario 1
> Should I consider this as an expected behaviour(ie a missing features
> in the C++ analysis), or as a bug. I've tried to find in the
> documentation what is currently available for C++ but I've not been
> able to find anything. Can someone point me in the right direction?
> Jean-Baptiste
> _______________________________________________
> 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