68 lines
2.6 KiB
HTML
68 lines
2.6 KiB
HTML
|
<!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>
|