[cfe-dev] clang and scan-build help?

Anna Zaks ganna at apple.com
Fri Apr 20 11:53:43 PDT 2012

As others mentioned, you are trying to mix two tools.

There is the clang static analyzer. That's the tool, which uses scan-build. It statically analyzes the code and reports probable bugs (http://clang-analyzer.llvm.org/).

The Address Sanitizer tool is an alternative to Valgrind. ASan is using compiler-rt and "-faddress-sanitizer" option, which I see in your logs.

Both tools are bug finding tools but are based on different technology. ASan is dynamic - you find issues while executing the program. ASan almost always produces real issues, but only catches memory issues (is in process of being extended to catch threading issues as well). However, it only produces the issues that are exercisable by your tests. The static analyzer is like a super heavy weight compiler. The static analyzer has a wider variety of checks and does not depend on tests; however, it will produce more false alarms and its analyzes are currently limited to a single translation unit (file).


On Apr 20, 2012, at 11:33 AM, Sean McBride wrote:

> On Fri, 20 Apr 2012 07:56:53 +0200, Plank, Stefan said:
>> Just trying to use clang as valgrind alternative and scan-build for
>> static code analysis together.
> If you're looking for a valgrind alternative, these may be more interesting:
> <http://clang.llvm.org/docs/AddressSanitizer.html>
> <http://embed.cs.utah.edu/ioc/>
> Cheers,
> -- 
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com 
> Mac Software Developer              Montréal, Québec, Canada
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120420/5c580f4c/attachment.html>

More information about the cfe-dev mailing list