1==================================
2Clang-tidy IDE/Editor Integrations
3==================================
4
5.. _Clangd: https://clang.llvm.org/extra/clangd.html
6
7Apart from being a standalone tool, :program:`clang-tidy` is integrated into
8various IDEs, code analyzers, and editors. Besides, it is currently being
9integrated into Clangd_. The following table shows the most
10well-known :program:`clang-tidy` integrations in detail.
11
12+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
13|                                      |        Feature                                                                                                                                           |
14+======================================+========================+=================================+==========================+=========================================+==========================+
15|  **Tool**                            | On-the-fly inspection  | Check list configuration (GUI)  | Options to checks (GUI)  | Configuration via ``.clang-tidy`` files | Custom clang-tidy binary |
16+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
17|A.L.E. for Vim                        |         \+\            |               \-\               |           \-\            |                 \-\                     |           \+\            |
18+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
19|Clang Power Tools for Visual Studio   |         \-\            |               \+\               |           \-\            |                 \+\                     |           \-\            |
20+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
21|Clangd                                |         \+\            |               \-\               |           \-\            |                 \-\                     |           \-\            |
22+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
23|CLion IDE                             |         \+\            |               \+\               |           \+\            |                 \+\                     |           \+\            |
24+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
25|CodeChecker                           |         \-\            |               \-\               |           \-\            |                 \-\                     |           \+\            |
26+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
27|CPPCheck                              |         \-\            |               \-\               |           \-\            |                 \-\                     |           \-\            |
28+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
29|CPPDepend                             |         \-\            |               \-\               |           \-\            |                 \-\                     |           \-\            |
30+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
31|Flycheck for Emacs                    |         \+\            |               \-\               |           \-\            |                 \+\                     |           \+\            |
32+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
33|KDevelop IDE                          |         \-\            |               \+\               |           \+\            |                 \+\                     |           \+\            |
34+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
35|Qt Creator IDE                        |         \+\            |               \+\               |           \-\            |                 \+\                     |           \+\            |
36+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
37|ReSharper C++ for Visual Studio       |         \+\            |               \+\               |           \-\            |                 \+\                     |           \+\            |
38+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
39|Syntastic for Vim                     |         \+\            |               \-\               |           \-\            |                 \-\                     |           \+\            |
40+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
41|Visual Assist for Visual Studio       |         \+\            |               \+\               |           \-\            |                 \-\                     |           \-\            |
42+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
43
44**IDEs**
45
46.. _CLion: https://www.jetbrains.com/clion/
47.. _integrates clang-tidy: https://www.jetbrains.com/help/clion/clang-tidy-checks-support.html
48
49CLion_ 2017.2 and later `integrates clang-tidy`_ as an extension to the
50built-in code analyzer. Starting from 2018.2 EAP, CLion allows using
51:program:`clang-tidy` via Clangd. Inspections and applicable quick-fixes are
52performed on the fly, and checks can be configured in standard command line
53format. In this integration, you can switch to the :program:`clang-tidy`
54binary different from the bundled one, pass the configuration in
55``.clang-tidy`` files instead of using the IDE settings, and configure
56options for particular checks.
57
58.. _KDevelop: https://www.kdevelop.org/
59.. _kdev-clang-tidy: https://github.com/KDE/kdev-clang-tidy/
60
61KDevelop_ with the kdev-clang-tidy_ plugin, starting from version 5.1, performs
62static analysis using :program:`clang-tidy`. The plugin launches the
63:program:`clang-tidy` binary from the specified location and parses its
64output to provide a list of issues.
65
66.. _QtCreator: https://www.qt.io/
67.. _Clang Code Model: https://doc.qt.io/qtcreator/creator-clang-codemodel.html
68.. _Clang Tools: https://doc.qt.io/qtcreator/creator-clang-tools.html
69
70QtCreator_ 4.6 integrates :program:`clang-tidy` warnings into the editor
71diagnostics under the `Clang Code Model`_. To employ :program:`clang-tidy`
72inspection in QtCreator, you need to create a copy of one of the presets and
73choose the checks to be performed. Since QtCreator 4.7 project-wide analysis is
74possible with the `Clang Tools`_ analyzer.
75
76.. _MS Visual Studio: https://visualstudio.microsoft.com/
77.. _ReSharper C++: https://www.jetbrains.com/help/resharper/Clang_Tidy_Integration.html
78.. _Visual Assist: https://docs.wholetomato.com/default.asp?W761
79.. _Clang Power Tools: https://marketplace.visualstudio.com/items?itemName=caphyon.ClangPowerTools
80.. _clang-tidy-vs: https://github.com/llvm/llvm-project/tree/master/clang-tools-extra/clang-tidy-vs
81
82`MS Visual Studio`_ has a native clang-tidy-vs_ plugin and also can integrate
83:program:`clang-tidy` by means of three other tools. The `ReSharper C++`_
84extension, version 2017.3 and later, provides seamless :program:`clang-tidy`
85integration: checks and quick-fixes run alongside native inspections. Apart
86from that, ReSharper C++ incorporates :program:`clang-tidy` as a separate
87step of its code clean-up process. `Visual Assist`_ build 2210 includes a
88subset of :program:`clang-tidy` checklist to inspect the code as you edit.
89Another way to bring :program:`clang-tidy` functionality to Visual Studio is
90the `Clang Power Tools`_ plugin, which includes most of the
91:program:`clang-tidy` checks and runs them during compilation or as a separate
92step of code analysis.
93
94**Editors**
95
96.. _Flycheck: https://github.com/ch1bo/flycheck-clang-tidy
97.. _Syntastic: https://github.com/vim-syntastic/syntastic
98.. _A.L.E.: https://github.com/w0rp/ale
99.. _Emacs24: https://www.gnu.org/s/emacs/
100.. _Vim: https://www.vim.org/
101
102Emacs24_, when expanded with the Flycheck_ plugin, incorporates the
103:program:`clang-tidy` inspection into the syntax analyzer. For Vim_, you can
104use Syntastic_, which includes :program:`clang-tidy`, or `A.L.E.`_,
105a lint engine that applies :program:`clang-tidy` along with other linters.
106
107**Analyzers**
108
109.. _CPPDepend: https://www.cppdepend.com/cppdependv2018
110.. _CPPCheck: https://sourceforge.net/p/cppcheck/news/
111.. _CodeChecker: https://github.com/Ericsson/codechecker
112.. _plugin: https://github.com/Ericsson/CodeCheckerEclipsePlugin
113
114:program:`clang-tidy` is integrated in CPPDepend_ starting from version 2018.1
115and CPPCheck_ 1.82. CPPCheck integration lets you import Visual Studio
116solutions and run the :program:`clang-tidy` inspection on them. The
117CodeChecker_ application of version 5.3 or later, which also comes as a plugin_
118for Eclipse, supports :program:`clang-tidy` as a static analysis instrument and
119allows to use a custom :program:`clang-tidy` binary.
120