summaryrefslogtreecommitdiffstats
path: root/docs/clang_static_analyzer.md
diff options
context:
space:
mode:
authorandybons <andybons@chromium.org>2015-08-24 14:37:09 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-24 21:39:36 +0000
commit3322f7611ba1444e553b2cce4de3a1a32ad46e72 (patch)
treedfb6bbea413da0581b8d085b184a5e6ceea5af3e /docs/clang_static_analyzer.md
parent5d58c9eb2baa203be1b84ac88cde82c59d72f143 (diff)
downloadchromium_src-3322f7611ba1444e553b2cce4de3a1a32ad46e72.zip
chromium_src-3322f7611ba1444e553b2cce4de3a1a32ad46e72.tar.gz
chromium_src-3322f7611ba1444e553b2cce4de3a1a32ad46e72.tar.bz2
Per https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/irLAQ8f8uGk
Initial migration of wiki content over to src/docs There will be a follow-up CL to ensure docs are following chromium’s style guide, links are fixed, etc. The file auditing was becoming too much for a single change and per Nico’s suggestion, it seems to be better to do + Bulk import with initial prune. + Follow-up CLs to clean up the documentation. So that each CL has its own purpose. BUG=none Review URL: https://codereview.chromium.org/1309473002 Cr-Commit-Position: refs/heads/master@{#345186}
Diffstat (limited to 'docs/clang_static_analyzer.md')
-rw-r--r--docs/clang_static_analyzer.md56
1 files changed, 56 insertions, 0 deletions
diff --git a/docs/clang_static_analyzer.md b/docs/clang_static_analyzer.md
new file mode 100644
index 0000000..84179f8
--- /dev/null
+++ b/docs/clang_static_analyzer.md
@@ -0,0 +1,56 @@
+See the [official clang static analyzer page](http://clang-analyzer.llvm.org/) for background.
+
+We don't run this regularly (because the analyzer's [support for C++ isn't great yet](http://clang-analyzer.llvm.org/dev_cxx.html)), so everything on this page is likely broken. The last time I checked, the analyzer reported mostly uninteresting things. This assumes you're [building chromium with clang](Clang.md).
+
+You need an llvm checkout to get `scan-build` and `scan-view`; the easiest way to get that is to run
+```
+tools/clang/scripts/update.sh --force-local-build --without-android
+```
+
+## With make
+
+To build base, if you use the make build:
+
+```
+builddir_name=out_analyze \
+PATH=$PWD/third_party/llvm-build/Release+Asserts/bin:$PATH \
+third_party/llvm/tools/clang/tools/scan-build/scan-build \
+ --keep-going --use-cc clang --use-c++ clang++ \
+ make -j8 base
+```
+
+(`builddir_name` is set to force a clobber build.)
+
+Once that's done, run `third_party/llvm/tools/clang/tools/scan-view/scan-view` to see the results; pass in the pass that `scan-build` outputs.
+
+## With ninja
+
+scan-build does its stuff by mucking with $CC/$CXX, which ninja ignores. gyp does look at $CC/$CXX however, so you need to first run gyp\_chromium under scan-build:
+```
+time GYP_GENERATORS=ninja \
+GYP_DEFINES='component=shared_library clang_use_chrome_plugins=0 mac_strip_release=0 dcheck_always_on=1' \
+third_party/llvm/tools/clang/tools/scan-build/scan-build \
+ --use-analyzer $PWD/third_party/llvm-build/Release+Asserts/bin/clang \
+ build/gyp_chromium -Goutput_dir=out_analyze
+```
+You then need to run the build under scan-build too, to get a HTML report:
+```
+time third_party/llvm/tools/clang/tools/scan-build/scan-build \
+ --use-analyzer $PWD/third_party/llvm-build/Release+Asserts/bin/clang \
+ ninja -C out_analyze/Release/ base
+```
+Then run `scan-view` as described above.
+
+## Known False Positives
+
+ * http://llvm.org/bugs/show_bug.cgi?id=11425
+
+## Stuff found by the static analyzer
+
+ * http://code.google.com/p/skia/issues/detail?id=399
+ * http://code.google.com/p/skia/issues/detail?id=400
+ * http://codereview.chromium.org/8308008/
+ * http://codereview.chromium.org/8313008/
+ * http://codereview.chromium.org/8308009/
+ * http://codereview.chromium.org/10031018/
+ * https://codereview.chromium.org/12390058/ \ No newline at end of file