diff options
author | Anna Zaks <ganna@apple.com> | 2012-01-06 01:54:08 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-01-06 01:54:08 +0000 |
commit | a772b86a6edaf9f110bf7d3e6c8201723371bc9a (patch) | |
tree | 7a1513623e6876c9a449c4a793ed624dc80705d1 /www | |
parent | dd40b84040b0cf43f94f4c25014ccda379d8610b (diff) |
[analyzer] Update the docs to reflect that gcc is not the only default
compiler option.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147645 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'www')
-rw-r--r-- | www/analyzer/scan-build.html | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/www/analyzer/scan-build.html b/www/analyzer/scan-build.html index 6c2833e799..e257407d86 100644 --- a/www/analyzer/scan-build.html +++ b/www/analyzer/scan-build.html @@ -35,9 +35,9 @@ web browser.</p> <p><b>scan-build</b> has little or no knowledge about how you build your code. It works by overriding the <tt>CC</tt> and <tt>CXX</tt> environment variables to (hopefully) change your build to use a "fake" compiler instead of the -one that would normally build your project. By default, this fake compiler -executes <tt>gcc</tt> to compile your code (assuming that <tt>gcc</tt> is your -compiler) and then executes the static analyzer to analyze your code.</p> +one that would normally build your project. This fake compiler executes either +<tt>clang</tt> or <tt>gcc</tt> (depending on the platform) to compile your +code and then executes the static analyzer to analyze your code.</p> <p>This "poor man's interposition" works amazingly well in many cases and falls down in others. Please consult the information on this page on making @@ -77,8 +77,8 @@ aforementioned hack fails to work.</p> <p>The <tt>scan-build</tt> command can be used to analyze an entire project by essentially interposing on a project's build process. This means that to run the analyzer using <tt>scan-build</tt>, you will use <tt>scan-build</tt> to analyze -the source files compiled by <tt>gcc</tt> during a project build. This means -that any files that are not compiled will also not be analyzed.</p> +the source files compiled by <tt>gcc</tt>/<tt>clang</tt> during a project build. +This means that any files that are not compiled will also not be analyzed.</p> <h3 id="scanbuild_basicusage">Basic Usage</h3> @@ -217,7 +217,7 @@ $ scan-build make <i>interposing</i> on the compiler. This interposition is currently done by <tt>scan-build</tt> temporarily setting the environment variable <tt>CC</tt> to <tt>ccc-analyzer</tt>. The program <tt>ccc-analyzer</tt> acts like a fake -compiler, forwarding its command line arguments over to <tt>gcc</tt> to perform +compiler, forwarding its command line arguments over to the compiler to perform regular compilation and <tt>clang</tt> to perform static analysis.</p> <p>Running <tt>configure</tt> typically generates makefiles that have hardwired @@ -314,18 +314,17 @@ $ scan-build xcodebuild -configuration Debug -sdk iphonesimulator3.0 <h3>Gotcha: using the right compiler</h3> -<p>Recall that <b>scan-build</b> analyzes your project by using <tt>gcc</tt> to -compile the project and <tt>clang</tt> to analyze your project. When analyzing +<p>Recall that <b>scan-build</b> analyzes your project by using a compiler to +compile the project and <tt>clang</tt> to analyze your project. The script uses +simple heuristics to determine which compiler should be used (it defaults to +<tt>clang</tt> on Darwin and <tt>gcc</tt> on other platforms). When analyzing iPhone projects, <b>scan-build</b> may pick the wrong compiler than the one -Xcode would use to build your project. This is because multiple versions of -<tt>gcc</tt> may be installed on your system, especially if you are developing -for the iPhone.</p> - -<p>Where this particularly might be a problem is if you are using Mac OS 10.5 -(Leopard) to develop for iPhone OS 3.0. The default desktop compiler on Leopard -is gcc-4.0, while the compiler for iPhone OS 3.0 is gcc-4.2. When compiling your -application to run on the simulator, it is important that <b>scan-build</b> -finds the correct version of <tt>gcc</tt>. Otherwise, you may see strange build +Xcode would use to build your project. For example, this could be because +multiple versions of a compiler may be installed on your system, especially if +you are developing for the iPhone.</p> + +<p>When compiling your application to run on the simulator, it is important that <b>scan-build</b> +finds the correct version of <tt>gcc/clang</tt>. Otherwise, you may see strange build errors that only happen when you run <tt>scan-build</tt>. <p><b>scan-build</b> provides the <tt>--use-cc</tt> and <tt>--use-c++</tt> |