Add a tool for the Clang Static Analyzer.
Review Request #8819 — Created March 16, 2017 and submitted — Latest diff uploaded
This change adds a new Review Bot tool to run
clang --analyze
.Setting up clang properly requires some configuration. In particular, the
static analyzer needs the compiler to be able to run successfully (though not
the linker), so the user may need to add a bunch of import paths or other
configuration to the command line. I've facilitated this by including a setting
for additional command-line arguments, which is split withshlex
and then
appended to theclang
command line.Clang is the first tool that can actually report multiple lines per comment.
I've fixed up the review functionality to properly translate the line numbers
for this.
Connected the git repository to my local Review Board, configured it in the
Review Bot worker, and then used the post-commit UI to create review requests
for a bunch of different commits. Most of them are pretty clean, but saw that
in a few cases, the clang static analyzer ran successfully and reported the
bugs.