xref: /openbsd-src/gnu/llvm/clang/www/analyzer/command-line.html (revision e5dd70708596ae51455a0ffa086a00c5b29f8583)
1*e5dd7070Spatrick<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2*e5dd7070Spatrick          "http://www.w3.org/TR/html4/strict.dtd">
3*e5dd7070Spatrick<html>
4*e5dd7070Spatrick<head>
5*e5dd7070Spatrick  <title>Running the analyzer from the command line</title>
6*e5dd7070Spatrick  <link type="text/css" rel="stylesheet" href="content.css">
7*e5dd7070Spatrick  <link type="text/css" rel="stylesheet" href="menu.css">
8*e5dd7070Spatrick  <script type="text/javascript" src="scripts/menu.js"></script>
9*e5dd7070Spatrick</head>
10*e5dd7070Spatrick<body>
11*e5dd7070Spatrick
12*e5dd7070Spatrick<div id="page">
13*e5dd7070Spatrick<!--#include virtual="menu.html.incl"-->
14*e5dd7070Spatrick<div id="content">
15*e5dd7070Spatrick
16*e5dd7070Spatrick<h1>Running the analyzer from the command line</h1>
17*e5dd7070Spatrick
18*e5dd7070Spatrick<p> Static Analyzer is by design a GUI tool. Its purpose is to find buggy execution
19*e5dd7070Spatrickpaths in the program, and such paths are very hard to comprehend by looking at
20*e5dd7070Spatricka non-interactive standard output. It is possible, however, to invoke the
21*e5dd7070SpatrickStatic Analyzer from the command line in order to obtain analysis results, and
22*e5dd7070Spatrickthen later view them interactively in a graphical interface. The following
23*e5dd7070Spatricktools are used commonly to run the analyzer from the command line. Both tools
24*e5dd7070Spatrickare wrapper scripts to drive the analysis and the underlying invocations of the
25*e5dd7070SpatrickClang compiler:
26*e5dd7070Spatrick<ol>
27*e5dd7070Spatrick  <li><a href="scan-build.html">Scan-Build</a>
28*e5dd7070Spatrick    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.
29*e5dd7070Spatrick  </li>
30*e5dd7070Spatrick  <ul>
31*e5dd7070Spatrick    <li>
32*e5dd7070Spatrick      Useful for individual developers who simply want to view static analysis results at their desk, or in a very simple collaborative environment.
33*e5dd7070Spatrick    </li>
34*e5dd7070Spatrick    <li>
35*e5dd7070Spatrick      Works on all major platforms (Windows, Linux, macOS) and is available as a package in many Linux distributions.
36*e5dd7070Spatrick    </li>
37*e5dd7070Spatrick    <li>
38*e5dd7070Spatrick      Does not include support for cross-translation-unit analysis.
39*e5dd7070Spatrick    </li>
40*e5dd7070Spatrick  </ul>
41*e5dd7070Spatrick  <li><a href="codechecker.html">CodeChecker</a>
42*e5dd7070Spatrick     is a web server that runs the Static Analyzer on your projects on demand and maintains a database of issues.
43*e5dd7070Spatrick  </li>
44*e5dd7070Spatrick  <ul>
45*e5dd7070Spatrick    <li>
46*e5dd7070Spatrick      Perfect for managing large amounts of Static Analyzer warnings in a collaborative environment.
47*e5dd7070Spatrick    </li>
48*e5dd7070Spatrick    <li>
49*e5dd7070Spatrick      Generally much more feature-rich than scan-build.
50*e5dd7070Spatrick    </li>
51*e5dd7070Spatrick    <li>Supports incremental analysis: Results can be stored in a database, subsequent analysis runs can be compared to list the newly added defects.</li>
52*e5dd7070Spatrick    <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>
53*e5dd7070Spatrick    <li>Can run clang-tidy checkers too.</li>
54*e5dd7070Spatrick    <li>Open source, but out-of-tree, i.e. not part of the LLVM project.</li>
55*e5dd7070Spatrick  </ul>
56*e5dd7070Spatrick</ol>
57*e5dd7070Spatrick</p>
58*e5dd7070Spatrick
59*e5dd7070Spatrick<p>
60*e5dd7070Spatrick</p>
61*e5dd7070Spatrick<p>
62*e5dd7070Spatrick</p>
63*e5dd7070Spatrick
64*e5dd7070Spatrick</div>
65*e5dd7070Spatrick</div>
66*e5dd7070Spatrick</body>
67*e5dd7070Spatrick</html>
68