[clang] 4cfb91f - [Analyzer][Docs][NFC] Add CodeChecker to the command line tools

Gabor Marton via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 12 05:23:27 PST 2019


Author: Gabor Marton
Date: 2019-12-12T14:22:52+01:00
New Revision: 4cfb91f1ef1b136f82015b792d6f1fafd47fd437

URL: https://github.com/llvm/llvm-project/commit/4cfb91f1ef1b136f82015b792d6f1fafd47fd437
DIFF: https://github.com/llvm/llvm-project/commit/4cfb91f1ef1b136f82015b792d6f1fafd47fd437.diff

LOG: [Analyzer][Docs][NFC] Add CodeChecker to the command line tools

We add a new common html file that documents the available command line
tools. Also a new html is added for a brief description of CodeChecker,
this way complementing scan-build.

Differential Revision: https://reviews.llvm.org/D70439

Added: 
    clang/www/analyzer/codechecker.html
    clang/www/analyzer/command-line.html

Modified: 
    clang/www/analyzer/index.html

Removed: 
    


################################################################################
diff  --git a/clang/www/analyzer/codechecker.html b/clang/www/analyzer/codechecker.html
new file mode 100644
index 000000000000..469b3ceaebf8
--- /dev/null
+++ b/clang/www/analyzer/codechecker.html
@@ -0,0 +1,73 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+          "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>CodeChecker: running the analyzer from the command line</title>
+  <link type="text/css" rel="stylesheet" href="content.css">
+  <link type="text/css" rel="stylesheet" href="menu.css">
+  <script type="text/javascript" src="scripts/menu.js"></script>
+</head>
+<body>
+
+<div id="page">
+<!--#include virtual="menu.html.incl"-->
+<div id="content">
+
+<h1>CodeChecker: running the analyzer from the command line</h1>
+
+<h2>Basic Usage</h2>
+
+<p>
+Install CodeChecker as described here: <a href="https://github.com/Ericsson/codechecker/#Install-guide"> CodeChecker Install Guide.</a>
+</p>
+
+<p>
+Create a compilation database. If you use cmake then pass the <tt>-DCMAKE_EXPORT_COMPILE_COMMANDS=1</tt> parameter to cmake. Cmake will create a <tt>compile_commands.json</tt> file.
+If you have a Makefile based or similar build system then you can log the build commands with the help of CodeChecker:
+<pre class="code_example">
+make clean
+CodeChecker log -b "make" -o compile_commands.json
+</pre>
+</p>
+
+<p>
+Analyze your project.
+<pre class="code_example">
+CodeChecker analyze compile_commands.json -o ./reports
+</pre>
+</p>
+
+<p>
+View the analysis results.
+Print the detailed results in the command line:
+<pre class="code_example">
+CodeChecker parse --print-steps ./reports
+</pre>
+Or view the detailed results in a browser:
+<pre class="code_example">
+CodeChecker parse ./reports -e html -o ./reports_html
+firefox ./reports_html/index.html
+</pre>
+</p>
+
+<p>
+Optional: store the analysis results in a DB.
+<pre class="code_example">
+mkdir ./ws
+CodeChecker server -w ./ws -v 8555 &
+CodeChecker store ./reports --name my-project --url http://localhost:8555/Default
+</pre>
+</p>
+
+<p>
+Optional: manage (categorize, suppress) the results in your web browser:
+<pre class="code_example">
+firefox http://localhost:8555/Default
+</pre>
+</p>
+
+<h2>Detailed Usage</h2>
+
+<p>
+For extended documentation please refer to the <a href="https://github.com/Ericsson/codechecker/blob/master/docs/usage.md">official site of CodeChecker</a>!
+</p>

diff  --git a/clang/www/analyzer/command-line.html b/clang/www/analyzer/command-line.html
new file mode 100644
index 000000000000..e536a7706eed
--- /dev/null
+++ b/clang/www/analyzer/command-line.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+          "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+  <title>Running the analyzer from the command line</title>
+  <link type="text/css" rel="stylesheet" href="content.css">
+  <link type="text/css" rel="stylesheet" href="menu.css">
+  <script type="text/javascript" src="scripts/menu.js"></script>
+</head>
+<body>
+
+<div id="page">
+<!--#include virtual="menu.html.incl"-->
+<div id="content">
+
+<h1>Running the analyzer from the command line</h1>
+
+<p> Static Analyzer is by design a GUI tool. Its purpose is to find buggy execution
+paths in the program, and such paths are very hard to comprehend by looking at
+a non-interactive standard output. It is possible, however, to invoke the
+Static Analyzer from the command line in order to obtain analysis results, and
+then later view them interactively in a graphical interface. The following
+tools are used commonly to run the analyzer from the command line. Both tools
+are wrapper scripts to drive the analysis and the underlying invocations of the
+Clang compiler:
+<ol>
+  <li><a href="scan-build.html">Scan-Build</a>
+    is an old and simple command-line tool that emits static analyzer warnings as HTML files while compiling your project. You can view the analysis results in your web browser.
+  </li>
+  <ul>
+    <li>
+      Useful for individual developers who simply want to view static analysis results at their desk, or in a very simple collaborative environment.
+    </li>
+    <li>
+      Works on all major platforms (Windows, Linux, macOS) and is available as a package in many Linux distributions.
+    </li>
+    <li>
+      Does not include support for cross-translation-unit analysis.
+    </li>
+  </ul>
+  <li><a href="codechecker.html">CodeChecker</a>
+     is a web server that runs the Static Analyzer on your projects on demand and maintains a database of issues.
+  </li>
+  <ul>
+    <li>
+      Perfect for managing large amounts of Static Analyzer warnings in a collaborative environment.
+    </li>
+    <li>
+      Generally much more feature-rich than scan-build.
+    </li>
+    <li>Supports incremental analysis: Results can be stored in a database, subsequent analysis runs can be compared to list the newly added defects.</li>
+    <li><a href="https://clang.llvm.org/docs/analyzer/user-docs/CrossTranslationUnit.html">Cross Translation Unit (CTU) analysis</a> is supported fully on Linux via CodeChecker.</li>
+    <li>Can run clang-tidy checkers too.</li>
+    <li>Open source, but out-of-tree, i.e. not part of the LLVM project.</li>
+  </ul>
+</ol>
+</p>
+
+<p>
+</p>
+<p>
+</p>
+
+</div>
+</div>
+</body>
+</html>

diff  --git a/clang/www/analyzer/index.html b/clang/www/analyzer/index.html
index df53add83487..7beef7e912cc 100644
--- a/clang/www/analyzer/index.html
+++ b/clang/www/analyzer/index.html
@@ -72,9 +72,9 @@ <h1>Clang Static Analyzer</h1>
 <p>The Clang Static Analyzer is a source code analysis tool that finds bugs in
 C, C++, and Objective-C programs.</p>
 
-<p>Currently it can be run either as a <a href="scan-build.html">standalone
-tool</a> or <a href="xcode.html">within Xcode</a>. The standalone tool is
-invoked from the command line, and is intended to be run in tandem with a build
+<p>Currently it can be run either from the <a href="command-line.html">command
+  line</a> or if you use macOS then <a href="xcode.html">within Xcode</a>. When
+invoked from the command line, it is intended to be run in tandem with a build
 of a codebase.</p>
 
 <p>The analyzer is 100% open source and is part of the <a


        


More information about the cfe-commits mailing list