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