Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Unified Diff: docs/clang_static_analyzer.md

Issue 2617283002: Add Clang static analyzer to Clang toolchain defs in GN (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/toolchain/wrapper_utils.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: docs/clang_static_analyzer.md
diff --git a/docs/clang_static_analyzer.md b/docs/clang_static_analyzer.md
index ed9feab99e5b6460b79ff78c7954a945abe23f38..dd79d0fc2254edf94e31bb10ac53711fd4afcd20 100644
--- a/docs/clang_static_analyzer.md
+++ b/docs/clang_static_analyzer.md
@@ -3,71 +3,20 @@
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).
+As of early 2017, we have experimental support for the Clang static analysis
+tool in the Chrome build. Warnings generated by the analysis tool are logged
+to stderr along with other compiler errors at build time.
-You need an llvm checkout to get `scan-build` and `scan-view`; the easiest way
-to get that is to run
+To enable static analysis for your build, add the following line to your
+output directory's `args.gn`:
-```shell
-tools/clang/scripts/update.py --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:
-
-```shell
-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:
-
-```shell
-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
+use_clang_static_analyzer = true
```
-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
+The next time you rebuild, you should see static analysis warnings appear inline
+with the usual Clang build warnings and errors.
-* https://code.google.com/p/skia/issues/detail?id=399
-* https://code.google.com/p/skia/issues/detail?id=400
-* https://codereview.chromium.org/8308008/
-* https://codereview.chromium.org/8313008/
-* https://codereview.chromium.org/8308009/
-* https://codereview.chromium.org/10031018/
-* https://codereview.chromium.org/12390058/
+## Future plans/potential issues
+* Support for running under GOMA is untested, but will be added shortly if
+ feasible.
« no previous file with comments | « build/toolchain/wrapper_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698