You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang/docs/analyzer/user-docs/CommandLineUsage.rst
+52-51Lines changed: 52 additions & 51 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
-
Command Line Usage: CodeChecker and scan-build
2
-
===============================================
1
+
Command Line Usage: scan-build and CodeChecker
2
+
==============================================
3
3
4
4
This document provides guidelines for running Clang Static Analyzer from the command line on whole projects.
5
5
CodeChecker and scan-build are two CLI tools for using CSA on multiple files (tranlation units).
@@ -16,62 +16,19 @@ It is possible, however, to invoke the Static Analyzer from the command line in
16
16
The following tools are used commonly to run the analyzer from the command line.
17
17
Both tools are wrapper scripts to drive the analysis and the underlying invocations of the Clang compiler:
18
18
19
-
1. CodeChecker_ is a driver and web server that runs the Static Analyzer on your projects on demand and maintains a database of issues.
19
+
1. scan-build_ 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.
20
+
- Useful for individual developers who simply want to view static analysis results at their desk, or in a very simple collaborative environment.
21
+
- Works on all major platforms (Windows, Linux, macOS) and is available as a package in many Linux distributions.
22
+
- Does not include support for cross-translation-unit analysis.
23
+
24
+
2. CodeChecker_ is a driver and web server that runs the Static Analyzer on your projects on demand and maintains a database of issues.
20
25
- Perfect for managing large amounts of Static Analyzer warnings in a collaborative environment.
21
26
- Generally much more feature-rich than scan-build.
22
27
- Supports incremental analysis: Results can be stored in a database, subsequent analysis runs can be compared to list the newly added defects.
23
28
- :doc:`CrossTranslationUnit` is supported fully on Linux via CodeChecker.
24
29
- Can run clang-tidy checkers too.
25
30
- Open source, but out-of-tree, i.e. not part of the LLVM project.
26
31
27
-
2. scan-build_ 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.
28
-
- Useful for individual developers who simply want to view static analysis results at their desk, or in a very simple collaborative environment.
29
-
- Works on all major platforms (Windows, Linux, macOS) and is available as a package in many Linux distributions.
30
-
- Does not include support for cross-translation-unit analysis.
31
-
32
-
CodeChecker
33
-
-----------
34
-
35
-
Basic Usage
36
-
~~~~~~~~~~~
37
-
38
-
Install CodeChecker as described here: `CodeChecker Install Guide <https://github.com/Ericsson/codechecker/#Install-guide>`_.
39
-
40
-
Create a compilation database. If you use cmake then pass the ``-DCMAKE_EXPORT_COMPILE_COMMANDS=1`` parameter to cmake. Cmake will create a ``compile_commands.json`` file.
41
-
If you have a Makefile based or similar build system then you can log the build commands with the help of CodeChecker::
CodeChecker parse ./reports -e html -o ./reports_html
58
-
firefox ./reports_html/index.html
59
-
60
-
Optional: store the analysis results in a DB::
61
-
62
-
mkdir ./ws
63
-
CodeChecker server -w ./ws -v 8555 &
64
-
CodeChecker store ./reports --name my-project --url http://localhost:8555/Default
65
-
66
-
Optional: manage (categorize, suppress) the results in your web browser::
67
-
68
-
firefox http://localhost:8555/Default
69
-
70
-
Detailed Usage
71
-
~~~~~~~~~~~~~~
72
-
73
-
For extended documentation please refer to the `official site of CodeChecker <https://github.com/Ericsson/codechecker/blob/master/docs/usage.md>`_!
74
-
75
32
scan-build
76
33
----------
77
34
@@ -236,3 +193,47 @@ When compiling your application to run on the simulator, it is important that **
236
193
**scan-build** provides the ``--use-cc`` and ``--use-c++`` options to hardwire which compiler scan-build should use for building your code. Note that although you are chiefly interested in analyzing your project, keep in mind that running the analyzer is intimately tied to the build, and not being able to compile your code means it won't get fully analyzed (if at all).
237
194
238
195
If you aren't certain which compiler Xcode uses to build your project, try just running ``xcodebuild`` (without **scan-build**). You should see the full path to the compiler that Xcode is using, and use that as an argument to ``--use-cc``.
196
+
197
+
CodeChecker
198
+
-----------
199
+
200
+
Basic Usage
201
+
~~~~~~~~~~~
202
+
203
+
Install CodeChecker as described here: `CodeChecker Install Guide <https://github.com/Ericsson/codechecker/#Install-guide>`_.
204
+
205
+
Create a compilation database. If you use cmake then pass the ``-DCMAKE_EXPORT_COMPILE_COMMANDS=1`` parameter to cmake. Cmake will create a ``compile_commands.json`` file.
206
+
If you have a Makefile based or similar build system then you can log the build commands with the help of CodeChecker::
0 commit comments