... | ... | @@ -9,14 +9,14 @@ Table of Contents |
|
|
|
|
|
*Clang-Tidy* is a tool developed and maintained by the *Clang/LLVM* community. The official documentation can be found at [http://clang.llvm.org/extra/clang-tidy/](http://clang.llvm.org/extra/clang-tidy/).
|
|
|
|
|
|
# Install
|
|
|
# Install
|
|
|
|
|
|
When running Linux, *clang-tidy* is usually easy to get via your distribution’s package manager. On Ubuntu Linux:
|
|
|
|
|
|
~~~sh
|
|
|
sudo apt-get install clang-tidy
|
|
|
~~~
|
|
|
|
|
|
|
|
|
Additionally you can download directly in the [project page](http://releases.llvm.org/download.html).
|
|
|
|
|
|
# How to use it
|
... | ... | @@ -77,7 +77,7 @@ The previous example will work just with a very simple example contained in one |
|
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
|
|
~~~
|
|
|
|
|
|
This will create a file named `compile_commands.json` that we will use with the following python script from the [LLVM project](https://gitlab.inria.fr/felisce/extra/documentation/-/raw/master/Resources/Clang-tidy%20modernize/run-clang-tidy.py?inline=false)).
|
|
|
This will create a file named `compile_commands.json` that we will use with the following python script from the [LLVM project](run-clang-tidy.py)).
|
|
|
|
|
|
Once we have the script and the json file we can check and fix the whole project by the following way:
|
|
|
|
... | ... | @@ -85,7 +85,7 @@ Once we have the script and the json file we can check and fix the whole project |
|
|
run-clang-tidy.py -header-filter='.*' -checks='-*,modernize-use-override' -fix
|
|
|
~~~
|
|
|
|
|
|
You can run simmultaneously all the possible modernize commands using the following [shell script]( https://gitlab.inria.fr/felisce/extra/documentation/-/raw/master/Resources/Clang-tidy%20modernize/modernize.sh?inline=false).
|
|
|
You can run simmultaneously all the possible modernize commands using the following [shell script](modernize.sh).
|
|
|
|
|
|
~~~sh
|
|
|
sh modernize.sh
|
... | ... | @@ -97,4 +97,4 @@ sh modernize.sh |
|
|
- [Clang-Tidy](http://clang.llvm.org/extra/clang-tidy/)
|
|
|
- [Clang-Tidy, part 1: Modernize your source code using C++11/C++14](https://www.kdab.com/clang-tidy-part-1-modernize-source-code-using-c11c14/)
|
|
|
|
|
|
</div> |
|
|
\ No newline at end of file |
|
|
</div> |