From: Ted Kremenek This documents provides some notes on using the LLVM/clang static analyzer to
find bugs in C and Objective-C programs. Please note that this tool is very early in development, and there are
-many planned enhancements to improve both the precision and scope of its
-analysis algorithms as well as the kinds bugs it will find. Currently the analyzer is invoked as a command-line tool. It is intended to
-run in synchronous with a build of a project or code base. Analysis results are
+run in tandem with a build of a project or code base. Analysis results are
deposited in a directory as HTML files, which can then viewed using a web
-browser.High-Level Summary
-
Here are some important points we ask you to consider when using the static +analyzer:
+ +The analyzer performs a variety of checks on code, each requiring different -levels of analysis precision (more precision = more CPU time). While the -analyzer is being designed to be as fast and light-weight as possible, please -do not expect it to be as fast as compiling a program (even with -optimizations enabled). Some of the algorithms needed to find bugs require in -the worst case exponential time. The analyzer runs in a reasonable amount of -time by both bounding the amount of checking work it will do as well as using -clever algorithms to reduce the amount of work it must do to find bugs.
+Semi-regular pre-built binaries of the analyzer(packaged as a gzipped tar -file) are available on Mac OS X (10.5).
+Semi-regular pre-built binaries of the analyzer are available on Mac OS X +(10.5).
The latest build is: checker-36
+href="http://keeda.stanford.edu/~kremenek/checker/checker-36.tar.gz">checker-36.tar.gz (built June 11, 2008) -The entire set of previous builds can be found here. Packaged builds for -other platforms may eventually be provided, but as the tool is in its early -stages we are not actively promoting releases yet. If you wish to help -contribute regular builds of the analyzer on other platforms, please email the -Clang Developers' -mailing list.
+Packaged builds for other platforms may eventually be provided, but as the tool +is in its early stages we are not actively promoting releases yet. If you wish +to help contribute regular builds of the analyzer on other platforms, please +email the Clang +Developers' mailing list.Packaged builds of the analyzer expand to the following files:
@@ -236,10 +253,10 @@ Here are a few recommendations with running the analyzer:Most projects can be built in a "debug" mode that enables assertions. +Assertions are picked up by the static analyzer to prune infeasible paths, which +in some cases can greatly reduce the number of false positives (bogus error +reports) emitted by the tool.
scan-build takes a -v option to emit verbose output about +what it's doing; two -v options emit more information. Redirecting the +output of scan-build to a text file (make sure to redirect standard +error) is useful for filing bug reports against scan-build or the +analyzer, as we can see the exact options (and files) passed to the analyzer. +For more comprehendible logs, don't perform a parallel build.
This section provides information on debugging the analyzer, and troubleshooting +it when you have problems analyzing a particular project.
To analyze a project, scan-build simply sets the environment variable CC to the full path to ccc-analyzer. It also sets a few other environment variables to communicate to ccc-analyzer where to dump HTML -report files. +report files.
Some Makefiles (or equivalent project files) hardcode the compiler; for such projects simply overriding CC won't cause ccc-analyzer to be @@ -298,18 +315,21 @@ calling clang). ccc-analyzer tries to correctly forward all the arguments over to gcc, but this may not work perfectly (please report bugs of this kind). -
We encourage users to file bug reports for any problems that they +encounter.
-Outside Apple: Please file bugs (against -Clang) in LLVM's Bugzilla database.
+Apple-internal: Please file bugs in Radar against the llvm - clang -component.
+Please file +bugs (against Clang) in LLVM's Bugzilla database.
- +Please file bugs in Radar against the llvm - clang component.
+ + +