[cfe-dev] Static analysis without compilation

Ted Kremenek kremenek at apple.com
Mon Dec 3 10:11:13 PST 2012


On Dec 3, 2012, at 3:24 AM, Sujit Kamthe <Sujit.Kamthe at kpitcummins.com> wrote:

> Currently if I run static analyzer using -–analyze option and if there are any syntax errors or missing header errors then clang would just print the compilation diagnostics and won’t do any static analysis.
> If this is achieved clang can also be used as a pure static analysis tool.

Konstantin pretty much answered this in his reply, but the Clang Static Analyzer does not analyze invalid code.  The analyzer does a deep semantic analysis of your code, which means invalid code doesn't have precise semantics.  We could possibly relax its intolerance of invalid code, but missing headers, unsupported syntax, etc., usually imply big wholes in the compiler's understanding if what your code means.  This directly translates into poorer results for the static analyzer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121203/e3ef764f/attachment.html>


More information about the cfe-dev mailing list