This plugin provides an user interface within CLion to easily use clang-tidy on your project's sources. Results will be displayed within an intuitive UI which allows to select and apply single changes to your project.
What is clang-tidy
clang-tidy is part of Clang, the C/C++/ObjectiveC compiler backend of LLVM.
When running clang-tidy, it performs a static code analysis to find some common issues and code style violations and provides fixes which can be applied to your code.
Some checks of clang-tidy, formerly known as clang-modernize, checks for code constructs, which can be converted into modern C++11 syntax. For example this includes:
- converting iterator based or index based for loops into range based foreach loops
- adding the
overridekeyword to overridden functions in subclasses
- replacing function arguments to match the pass-by-value idiom to gain advantage from new move semantics
To learn more about clang-tidy visit
- Download this plugin from IntelliJ plugin portal.
- Visit llvm.org to download the latest version of llvm and clang or view instructions how to install them on your preferred linux distribution.
- In CLion open your settings and go to Other settings / clang-tidy and enter the full path to your clang-tidy executable.
- Before using clang-tidy, you should commit your current working directory into VCS or backup your project, if clang-tidy produces errors in your code.
- Right click on a single C/C++/ObjC file, opened editor or directory containing source files and select Refactor / clang-tidy.
- In the configuration dialog select the checks you want to apply and click OK to start clang-tidy.
- When finished, a list of all files containing issues will be displayed to you. Select the files you want to apply or click merge to view suggested fixes for a single selected file and apply them one by one.