From 926520489a6934b3668ee792dff266edb6a2e7c0 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 19 Feb 2010 08:14:02 +0000 Subject: [PATCH] Add section on using the analyzer within Xcode. llvm-svn: 96664 --- clang/www/analyzer/content.css | 18 +++- clang/www/analyzer/menu.html.incl | 7 +- clang/www/analyzer/scan-build.html | 105 ++++++++++++++++++----- clang/www/analyzer/xcode.html | 133 +++++++++++++++++++++++++++++ 4 files changed, 240 insertions(+), 23 deletions(-) create mode 100644 clang/www/analyzer/xcode.html diff --git a/clang/www/analyzer/content.css b/clang/www/analyzer/content.css index 823fae265c95..b22cca9ff55e 100644 --- a/clang/www/analyzer/content.css +++ b/clang/www/analyzer/content.css @@ -47,6 +47,21 @@ IMG.img_slide { /* Tables */ tr { vertical-align:top } +table.options thead { + background-color:#eee; color:#666666; + font-weight: bold; cursor: default; + text-align:left; + border-top: 2px solid #cccccc; + border-bottom: 2px solid #cccccc; + font-weight: bold; font-family: Verdana +} +table.options { border: 1px #cccccc solid } +table.options { border-collapse: collapse; border-spacing: 0px } +table.options { margin-left:0px; margin-top:20px; margin-bottom:20px } +table.options td { border-bottom: 1px #cccccc dotted } +table.options td { padding:5px; padding-left:8px; padding-right:8px } +table.options td { text-align:left; font-size:9pt } + /* Collapsing Trees: http://dbtree.megalingo.com/web/demo/simple-collapsible-tree.cfm */ #collapsetree, #collapsetree a:link, #collapsetree li a:link, #collapsetree a:visited, #collapsetree li a:visited{color:#000;text-decoration:none} #collapsetree,#collapsetree ul{list-style-type:none; width:auto; margin:0; padding:0} @@ -60,4 +75,5 @@ tr { vertical-align:top } #collapsetree ul li.click a{background:url(images/tree/bullet.gif) center left no-repeat} #collapsetree li a.subMenu,#collapsetree ul li a.subMenu{background:url(images/tree/plus.gif) center left no-repeat} #collapsetree li a.click{background:url(images/tree/minus.gif) center left no-repeat} -#collapsetree ul li a.click{background:url(images/tree/minus.gif) center left no-repeat} \ No newline at end of file +#collapsetree ul li a.click{background:url(images/tree/minus.gif) center left no-repeat} + diff --git a/clang/www/analyzer/menu.html.incl b/clang/www/analyzer/menu.html.incl index 8d465e44c2bd..8d218f7a7642 100644 --- a/clang/www/analyzer/menu.html.incl +++ b/clang/www/analyzer/menu.html.incl @@ -16,7 +16,12 @@ User Manual diff --git a/clang/www/analyzer/scan-build.html b/clang/www/analyzer/scan-build.html index 122c61587fed..eeff706ff234 100644 --- a/clang/www/analyzer/scan-build.html +++ b/clang/www/analyzer/scan-build.html @@ -5,7 +5,8 @@ scan-build: running the analyzer from the command line - + + @@ -13,23 +14,6 @@
- -

scan-build: running the analyzer from the command line

@@ -70,19 +54,22 @@ aforementioned hack fails to work.

Contents

-
+ +
+ +

What is it?

+

Build and Analyze is an Xcode feature (introduced in Xcode 3.2) that +allows users to run the Clang Static Analyzer directly +within Xcode.

+ +

It integrates directly with the Xcode build system and +presents analysis results directly within Xcode's editor.

+ +

Can I use the open source analyzer builds with Xcode?

+ +

Yes. Instructions are included below.

+ +
+
+ +
Viewing static analyzer results in Xcode
+
+ + +

Key features:

+ +--> + +

Getting Started

+ +

Xcode 3.2 is available as a free download from Apple, with instructions available +for using Build and Analyze.

+ +

Using open source analyzer builds with Build and Analyze

+ +

By default, Xcode uses the version of clang that came bundled with +it to provide the results for Build and Analyze. It is possible to change +Xcode's behavior to use an alternate version of clang for this purpose +while continuing to use the clang that came with Xcode for compiling +projects.

+ +

Why try open source builds?

+ +

The advantage of using open source analyzer builds (provided on this website) +is that they are often newer than the analyzer provided with Xcode, and thus can +contain bug fixes, new checks, or simply better analysis.

+ +

On the other hand, new checks can be experimental, with results of variable +quality. Users are encouraged to file bug reports +(for any version of the analyzer) where they encounter false positives or other +issues.

+ +

set-xcode-analyzer

+ +

Starting with analyzer build checker-234, analyzer builds contain a command +line utility called set-xcode-analyzer that allows users to change what +copy of clang that Xcode uses for Build and Analyze:

+ +
+$ set-xcode-analyzer -h
+Usage: set-xcode-analyzer [options]
+
+Options:
+  -h, --help            show this help message and exit
+  --use-checker-build=PATH
+                        Use the Clang located at the provided absolute path,
+                        e.g. /Users/foo/checker-1
+  --use-xcode-clang     Use the Clang bundled with Xcode
+
+ +

Operationally, set-xcode-analyzer edits Xcode's configuration files +(in /Developer) to point it to use the version of clang you +specify for static analysis. Within this model it provides you two basic modes:

+ + + +

Examples

+ +

Telling Xcode to use checker-235 for Build and Analyze:

+ +
+$ pwd
+/tmp
+$ tar xjf checker-235.tar.bz2
+$ checker-235/set-xcode-analyzer --use-checker-build=/tmp/checker-235
+
+ +

Telling Xcode to use a very specific version of clang:

+ +
+$ set-xcode-analyzer --use-checker-build=~/mycrazyclangbuild/bin/clang
+
+ +

Resetting Xcode to its default behavior:

+ +
+$ set-xcode-analyzer -use-xcode-clang
+
+ +
+ + + +