Clang-tidy IDE/Editor Integrations¶
Apart from being a standalone tool, clang-tidy is integrated into various IDEs, code analyzers, and editors. We recommend using clangd which integrates 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 clang-tidy integrations in detail.
Feature |
|||||
---|---|---|---|---|---|
Tool |
On-the-fly inspection |
Check list configuration (GUI) |
Options to checks (GUI) |
Configuration via |
Custom clang-tidy binary |
A.L.E. for Vim |
+ |
- |
- |
- |
+ |
Clang Power Tools for Visual Studio |
- |
+ |
- |
+ |
- |
Clangd |
+ |
- |
- |
+ |
- |
CLion IDE |
+ |
+ |
+ |
+ |
+ |
CodeChecker |
- |
- |
- |
- |
+ |
CPPCheck |
- |
- |
- |
- |
- |
CPPDepend |
- |
- |
- |
- |
- |
Flycheck for Emacs |
+ |
- |
- |
+ |
+ |
KDevelop IDE |
- |
+ |
+ |
+ |
+ |
Qt Creator IDE |
+ |
+ |
- |
+ |
+ |
ReSharper C++ for Visual Studio |
+ |
+ |
- |
+ |
+ |
Syntastic for Vim |
+ |
- |
- |
- |
+ |
Visual Assist for Visual Studio |
+ |
+ |
- |
- |
- |
IDEs
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
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 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 with the kdev-clang-tidy plugin, starting from version 5.1, performs static analysis using clang-tidy. The plugin launches the clang-tidy binary from the specified location and parses its output to provide a list of issues.
QtCreator 4.6 integrates clang-tidy warnings into the editor diagnostics under the Clang Code Model. To employ clang-tidy inspection in QtCreator, you need to create a copy of one of the presets and choose the checks to be performed. Since QtCreator 4.7 project-wide analysis is possible with the Clang Tools analyzer.
MS Visual Studio has a native clang-tidy-vs plugin and also can integrate clang-tidy by means of three other tools. The ReSharper C++ extension, version 2017.3 and later, provides seamless clang-tidy integration: checks and quick-fixes run alongside native inspections. Apart from that, ReSharper C++ incorporates clang-tidy as a separate step of its code clean-up process. Visual Assist build 2210 includes a subset of clang-tidy checklist to inspect the code as you edit. Another way to bring clang-tidy functionality to Visual Studio is the Clang Power Tools plugin, which includes most of the clang-tidy checks and runs them during compilation or as a separate step of code analysis.
Editors
Emacs24, when expanded with the Flycheck plugin, incorporates the clang-tidy inspection into the syntax analyzer. For Vim, you can use Syntastic, which includes clang-tidy, or A.L.E., a lint engine that applies clang-tidy along with other linters.
Analyzers
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 clang-tidy inspection on them. The CodeChecker application of version 5.3 or later, which also comes as a plugin for Eclipse, supports clang-tidy as a static analysis instrument and allows to use a custom clang-tidy binary.