[cfe-commits] r147645 - in /cfe/trunk: tools/scan-build/scan-build www/analyzer/scan-build.html
Anna Zaks
ganna at apple.com
Thu Jan 5 17:54:08 PST 2012
Author: zaks
Date: Thu Jan 5 19:54:08 2012
New Revision: 147645
URL: http://llvm.org/viewvc/llvm-project?rev=147645&view=rev
Log:
[analyzer] Update the docs to reflect that gcc is not the only default
compiler option.
Modified:
cfe/trunk/tools/scan-build/scan-build
cfe/trunk/www/analyzer/scan-build.html
Modified: cfe/trunk/tools/scan-build/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/scan-build?rev=147645&r1=147644&r2=147645&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/scan-build (original)
+++ cfe/trunk/tools/scan-build/scan-build Thu Jan 5 19:54:08 2012
@@ -967,11 +967,11 @@
exit status of $Prog to be 1 if it found potential bugs
and 0 otherwise.
- --use-cc [compiler path] - By default, $Prog uses 'gcc' to compile and link
+ --use-cc [compiler path] - $Prog attempts to guess the default compiler for
--use-cc=[compiler path] your C and Objective-C code. Use this option
to specify an alternate compiler.
- --use-c++ [compiler path] - By default, $Prog uses 'g++' to compile and link
+ --use-c++ [compiler path] - $Prog attempts to guess the default compiler for
--use-c++=[compiler path] your C++ and Objective-C++ code. Use this option
to specify an alternate compiler.
Modified: cfe/trunk/www/analyzer/scan-build.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/scan-build.html?rev=147645&r1=147644&r2=147645&view=diff
==============================================================================
--- cfe/trunk/www/analyzer/scan-build.html (original)
+++ cfe/trunk/www/analyzer/scan-build.html Thu Jan 5 19:54:08 2012
@@ -35,9 +35,9 @@
<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 @@
<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 @@
<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 @@
<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>
More information about the cfe-commits
mailing list