2019-01-18 02:31:34 +08:00
|
|
|
==================================
|
|
|
|
Clang-tidy IDE/Editor Integrations
|
|
|
|
==================================
|
|
|
|
|
2020-09-16 18:09:29 +08:00
|
|
|
.. _clangd: http://clangd.llvm.org/
|
|
|
|
.. _is available: https://clangd.llvm.org/installation.html#editor-plugins
|
|
|
|
.. _more: https://langserver.org/#implementations-client
|
2019-01-18 02:31:34 +08:00
|
|
|
|
|
|
|
Apart from being a standalone tool, :program:`clang-tidy` is integrated into
|
2020-09-16 18:09:29 +08:00
|
|
|
various IDEs, code analyzers, and editors. We recommend using clangd_ which
|
|
|
|
integrates :program:`clang-tidy` and `is available`_ in most major editors
|
|
|
|
through plugins (Vim, Emacs, Visual Studio Code, Sublime Text and more_).
|
|
|
|
|
|
|
|
The following table shows the most well-known :program:`clang-tidy`
|
|
|
|
integrations in detail.
|
2019-01-18 02:31:34 +08:00
|
|
|
|
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
|
|
|
| | Feature |
|
|
|
|
+======================================+========================+=================================+==========================+=========================================+==========================+
|
|
|
|
| **Tool** | On-the-fly inspection | Check list configuration (GUI) | Options to checks (GUI) | Configuration via ``.clang-tidy`` files | Custom clang-tidy binary |
|
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
|
|
|
|A.L.E. for Vim | \+\ | \-\ | \-\ | \-\ | \+\ |
|
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
|
|
|
|Clang Power Tools for Visual Studio | \-\ | \+\ | \-\ | \+\ | \-\ |
|
2020-09-16 18:27:20 +08:00
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
2020-09-16 18:09:29 +08:00
|
|
|
|Clangd | \+\ | \-\ | \-\ | \+\ | \-\ |
|
2019-01-18 02:31:34 +08:00
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
|
|
|
|CLion IDE | \+\ | \+\ | \+\ | \+\ | \+\ |
|
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
|
|
|
|CodeChecker | \-\ | \-\ | \-\ | \-\ | \+\ |
|
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
|
|
|
|CPPCheck | \-\ | \-\ | \-\ | \-\ | \-\ |
|
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
|
|
|
|CPPDepend | \-\ | \-\ | \-\ | \-\ | \-\ |
|
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
|
|
|
|Flycheck for Emacs | \+\ | \-\ | \-\ | \+\ | \+\ |
|
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
|
|
|
|KDevelop IDE | \-\ | \+\ | \+\ | \+\ | \+\ |
|
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
2019-06-25 21:50:09 +08:00
|
|
|
|Qt Creator IDE | \+\ | \+\ | \-\ | \+\ | \+\ |
|
2019-01-18 02:31:34 +08:00
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
2019-05-09 02:12:12 +08:00
|
|
|
|ReSharper C++ for Visual Studio | \+\ | \+\ | \-\ | \+\ | \+\ |
|
2019-01-18 02:31:34 +08:00
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
|
|
|
|Syntastic for Vim | \+\ | \-\ | \-\ | \-\ | \+\ |
|
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
|
|
|
|Visual Assist for Visual Studio | \+\ | \+\ | \-\ | \-\ | \-\ |
|
|
|
|
+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+
|
|
|
|
|
|
|
|
**IDEs**
|
|
|
|
|
|
|
|
.. _CLion: https://www.jetbrains.com/clion/
|
|
|
|
.. _integrates clang-tidy: https://www.jetbrains.com/help/clion/clang-tidy-checks-support.html
|
|
|
|
|
|
|
|
CLion_ 2017.2 and later `integrates clang-tidy`_ as an extension to the
|
|
|
|
built-in code analyzer. Starting from 2018.2 EAP, CLion allows using
|
|
|
|
:program:`clang-tidy` via Clangd. Inspections and applicable quick-fixes are
|
|
|
|
performed on the fly, and checks can be configured in standard command line
|
|
|
|
format. In this integration, you can switch to the :program:`clang-tidy`
|
|
|
|
binary different from the bundled one, pass the configuration in
|
|
|
|
``.clang-tidy`` files instead of using the IDE settings, and configure
|
|
|
|
options for particular checks.
|
|
|
|
|
|
|
|
.. _KDevelop: https://www.kdevelop.org/
|
|
|
|
.. _kdev-clang-tidy: https://github.com/KDE/kdev-clang-tidy/
|
|
|
|
|
|
|
|
KDevelop_ with the kdev-clang-tidy_ plugin, starting from version 5.1, performs
|
|
|
|
static analysis using :program:`clang-tidy`. The plugin launches the
|
|
|
|
:program:`clang-tidy` binary from the specified location and parses its
|
|
|
|
output to provide a list of issues.
|
|
|
|
|
|
|
|
.. _QtCreator: https://www.qt.io/
|
2019-01-23 03:19:48 +08:00
|
|
|
.. _Clang Code Model: https://doc.qt.io/qtcreator/creator-clang-codemodel.html
|
2019-06-25 21:50:09 +08:00
|
|
|
.. _Clang Tools: https://doc.qt.io/qtcreator/creator-clang-tools.html
|
2019-01-18 02:31:34 +08:00
|
|
|
|
|
|
|
QtCreator_ 4.6 integrates :program:`clang-tidy` warnings into the editor
|
|
|
|
diagnostics under the `Clang Code Model`_. To employ :program:`clang-tidy`
|
|
|
|
inspection in QtCreator, you need to create a copy of one of the presets and
|
2019-06-25 21:50:09 +08:00
|
|
|
choose the checks to be performed. Since QtCreator 4.7 project-wide analysis is
|
|
|
|
possible with the `Clang Tools`_ analyzer.
|
2019-01-18 02:31:34 +08:00
|
|
|
|
|
|
|
.. _MS Visual Studio: https://visualstudio.microsoft.com/
|
|
|
|
.. _ReSharper C++: https://www.jetbrains.com/help/resharper/Clang_Tidy_Integration.html
|
|
|
|
.. _Visual Assist: https://docs.wholetomato.com/default.asp?W761
|
|
|
|
.. _Clang Power Tools: https://marketplace.visualstudio.com/items?itemName=caphyon.ClangPowerTools
|
2021-02-01 15:24:21 +08:00
|
|
|
.. _clang-tidy-vs: https://github.com/llvm/llvm-project/tree/main/clang-tools-extra/clang-tidy-vs
|
2019-01-18 02:31:34 +08:00
|
|
|
|
|
|
|
`MS Visual Studio`_ has a native clang-tidy-vs_ plugin and also can integrate
|
|
|
|
:program:`clang-tidy` by means of three other tools. The `ReSharper C++`_
|
|
|
|
extension, version 2017.3 and later, provides seamless :program:`clang-tidy`
|
|
|
|
integration: checks and quick-fixes run alongside native inspections. Apart
|
|
|
|
from that, ReSharper C++ incorporates :program:`clang-tidy` as a separate
|
|
|
|
step of its code clean-up process. `Visual Assist`_ build 2210 includes a
|
|
|
|
subset of :program:`clang-tidy` checklist to inspect the code as you edit.
|
|
|
|
Another way to bring :program:`clang-tidy` functionality to Visual Studio is
|
|
|
|
the `Clang Power Tools`_ plugin, which includes most of the
|
|
|
|
:program:`clang-tidy` checks and runs them during compilation or as a separate
|
|
|
|
step of code analysis.
|
|
|
|
|
|
|
|
**Editors**
|
|
|
|
|
|
|
|
.. _Flycheck: https://github.com/ch1bo/flycheck-clang-tidy
|
|
|
|
.. _Syntastic: https://github.com/vim-syntastic/syntastic
|
|
|
|
.. _A.L.E.: https://github.com/w0rp/ale
|
|
|
|
.. _Emacs24: https://www.gnu.org/s/emacs/
|
|
|
|
.. _Vim: https://www.vim.org/
|
|
|
|
|
|
|
|
Emacs24_, when expanded with the Flycheck_ plugin, incorporates the
|
|
|
|
:program:`clang-tidy` inspection into the syntax analyzer. For Vim_, you can
|
|
|
|
use Syntastic_, which includes :program:`clang-tidy`, or `A.L.E.`_,
|
|
|
|
a lint engine that applies :program:`clang-tidy` along with other linters.
|
|
|
|
|
|
|
|
**Analyzers**
|
|
|
|
|
|
|
|
.. _CPPDepend: https://www.cppdepend.com/cppdependv2018
|
|
|
|
.. _CPPCheck: https://sourceforge.net/p/cppcheck/news/
|
|
|
|
.. _CodeChecker: https://github.com/Ericsson/codechecker
|
|
|
|
.. _plugin: https://github.com/Ericsson/CodeCheckerEclipsePlugin
|
|
|
|
|
|
|
|
:program:`clang-tidy` is integrated in CPPDepend_ starting from version 2018.1
|
|
|
|
and CPPCheck_ 1.82. CPPCheck integration lets you import Visual Studio
|
|
|
|
solutions and run the :program:`clang-tidy` inspection on them. The
|
|
|
|
CodeChecker_ application of version 5.3 or later, which also comes as a plugin_
|
|
|
|
for Eclipse, supports :program:`clang-tidy` as a static analysis instrument and
|
|
|
|
allows to use a custom :program:`clang-tidy` binary.
|