aboutsummaryrefslogtreecommitdiffstats
path: root/doc/src/analyze/creator-clang-static-analyzer.qdoc
blob: 2c09fa0a759589e2c309e59c937793148c32d04f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/

// **********************************************************************
// NOTE: the sections are not ordered by their logical order to avoid
// reshuffling the file each time the index order changes (i.e., often).
// Run the fixnavi.pl script to adjust the links to the index order.
// **********************************************************************

/*!
    \contentspage {Qt Creator Manual}
    \previouspage creator-running-valgrind-remotely.html
    \page creator-clang-static-analyzer.html
    \nextpage creator-cpu-usage-analyzer.html

    \title Using Clang Static Analyzer

    \QC integrates the \l{http://clang-analyzer.llvm.org}
    {Clang Static Analyzer} for finding problems in C, C++, and Objective-C
    programs.

    \image qtcreator-clang-static-analyzer.png

    Select the link in the \uicontrol Location column to move to the location
    where the issue appears in the code editor.

    The Clang Static Analyzer runs with all the default checkers enabled. For
    more information about the checkers, see
    \l{http://clang-analyzer.llvm.org/available_checks.html}{Available Checkers}.

    To suppress diagnostics, select \uicontrol {Suppress This Diagnostic} in the
    context menu. To view the suppression list for a project and to remove
    diagnostics from it, select \uicontrol Projects >
    \uicontrol {Project Settings} > \uicontrol {Clang Static Analyzer}.

    \section1 Supported Project Types and Tool Chains

    The Clang Static Analyzer relies on the data (specific macros and include
    directories) from the projects and tool chains. Not all projects
    and tool chains can provide enough data for reasonable results.

    Currently, only Qbs and qmake projects together with the GCC, MinGW, Clang
    and Microsoft Visual Studio tool chains are supported.

    \section1 Setting Up Clang Static Analyzer

    As a tested version of Clang is shipped together with Qt Creator, no manual
    setup is required.

    To profit from improved checkers in newer Clang versions, \QC can be set up
    to use those. However, only the shipped version of Clang is tested and known
    to work. Other versions might not work at all.

    To set up a particular Clang version for the Clang Static Analyzer, select
    \uicontrol Tools > \uicontrol Options > \uicontrol Analyzer >
    \uicontrol {Clang Static Analyzer} and check that the path to the Clang
    executable is set correctly in the \uicontrol {Clang executable} field.

    \image qtcreator-clang-static-analyzer-options.png

    \section1 Running Clang Static Analyzer

    To run the Clang Static Analyzer to analyze an open project, select
    \uicontrol Analyze > \uicontrol {Clang Static Analyzer} on the menu bar. The
    Clang Static Analyzer starts automatically.

    However, if you select \uicontrol Debug in the mode selector to open the
    \uicontrol Debug mode and then select \uicontrol {Clang Static Analyzer},
    you must start the Clang Static Analyzer by selecting the
    \inlineimage qtcreator-analyze-start-button.png
    (\uicontrol Start) button.
*/