123 lines · plain
1==================================2Clang-tidy IDE/Editor Integrations3==================================4 5.. _clangd: http://clangd.llvm.org/6.. _is available: https://clangd.llvm.org/installation.html#editor-plugins7.. _more: https://langserver.org/#implementations-client8 9Apart from being a standalone tool, :program:`clang-tidy` is integrated into10various IDEs, code analyzers, and editors. We recommend using clangd_ which11integrates :program:`clang-tidy` and `is available`_ in most major editors12through plugins (Vim, Emacs, Visual Studio Code, Sublime Text and more_).13 14The following table shows the most well-known :program:`clang-tidy`15integrations in detail.16 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+--------------------------------------+------------------------+---------------------------------+--------------------------+-----------------------------------------+--------------------------+48 49**IDEs**50 51.. _CLion: https://www.jetbrains.com/clion/52.. _integrates clang-tidy: https://www.jetbrains.com/help/clion/clang-tidy-checks-support.html53 54CLion_ 2017.2 and later `integrates clang-tidy`_ as an extension to the55built-in code analyzer. Starting from 2018.2 EAP, CLion allows using56:program:`clang-tidy` via Clangd. Inspections and applicable quick-fixes are57performed on the fly, and checks can be configured in standard command line58format. In this integration, you can switch to the :program:`clang-tidy`59binary different from the bundled one, pass the configuration in60``.clang-tidy`` files instead of using the IDE settings, and configure61options for particular checks.62 63.. _KDevelop: https://www.kdevelop.org/64.. _kdev-clang-tidy: https://github.com/KDE/kdev-clang-tidy/65 66KDevelop_ with the kdev-clang-tidy_ plugin, starting from version 5.1, performs67static analysis using :program:`clang-tidy`. The plugin launches the68:program:`clang-tidy` binary from the specified location and parses its69output to provide a list of issues.70 71.. _QtCreator: https://www.qt.io/72.. _Clang Code Model: https://doc.qt.io/qtcreator/creator-clang-codemodel.html73.. _Clang Tools: https://doc.qt.io/qtcreator/creator-clang-tools.html74 75QtCreator_ 4.6 integrates :program:`clang-tidy` warnings into the editor76diagnostics under the `Clang Code Model`_. To employ :program:`clang-tidy`77inspection in QtCreator, you need to create a copy of one of the presets and78choose the checks to be performed. Since QtCreator 4.7 project-wide analysis is79possible with the `Clang Tools`_ analyzer.80 81.. _MS Visual Studio: https://visualstudio.microsoft.com/82.. _ReSharper C++: https://www.jetbrains.com/help/resharper/Clang_Tidy_Integration.html83.. _Visual Assist: https://docs.wholetomato.com/default.asp?W76184.. _Clang Power Tools: https://marketplace.visualstudio.com/items?itemName=caphyon.ClangPowerTools85 86`MS Visual Studio`_ can integrate :program:`clang-tidy` by means of three different tools.87The `ReSharper C++`_ extension, version 2017.3 and later, provides seamless88:program:`clang-tidy` integration: checks and quick-fixes run alongside native inspections.89Apart from that, ReSharper C++ incorporates :program:`clang-tidy` as a separate90step of its code clean-up process. `Visual Assist`_ build 2210 includes a91subset of :program:`clang-tidy` checklist to inspect the code as you edit.92Another way to bring :program:`clang-tidy` functionality to Visual Studio is93the `Clang Power Tools`_ plugin, which includes most of the94:program:`clang-tidy` checks and runs them during compilation or as a separate95step of code analysis.96 97**Editors**98 99.. _Flycheck: https://github.com/ch1bo/flycheck-clang-tidy100.. _Syntastic: https://github.com/vim-syntastic/syntastic101.. _A.L.E.: https://github.com/w0rp/ale102.. _Emacs24: https://www.gnu.org/s/emacs/103.. _Vim: https://www.vim.org/104 105Emacs24_, when expanded with the Flycheck_ plugin, incorporates the106:program:`clang-tidy` inspection into the syntax analyzer. For Vim_, you can107use Syntastic_, which includes :program:`clang-tidy`, or `A.L.E.`_,108a lint engine that applies :program:`clang-tidy` along with other linters.109 110**Analyzers**111 112.. _CPPDepend: https://www.cppdepend.com/cppdependv2018113.. _CPPCheck: https://sourceforge.net/p/cppcheck/news/114.. _CodeChecker: https://github.com/Ericsson/codechecker115.. _plugin: https://github.com/Ericsson/CodeCheckerEclipsePlugin116 117:program:`clang-tidy` is integrated in CPPDepend_ starting from version 2018.1118and CPPCheck_ 1.82. CPPCheck integration lets you import Visual Studio119solutions and run the :program:`clang-tidy` inspection on them. The120CodeChecker_ application of version 5.3 or later, which also comes as a plugin_121for Eclipse, supports :program:`clang-tidy` as a static analysis instrument and122allows to use a custom :program:`clang-tidy` binary.123