I have this cmake project that I would like to modernize using clang-tidy. In order not to have too many things happening at once, I only activated the modernize-use-override option. However, when I apply this:
$> run-clang-tidy -header-filter='.*' -checks='-*, modernize-use-override' -fix
to the project, clang-tidy inserts multiple instances of the override specifier, for example:
void update_sizes() override override override etc.
I tried to follow the advice given here and used cmake to create a json compile command data base:
$>cmake ../../ -DCMAKE_BUILD_TYPE=debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
I made sure cmake is actually picking up the clang compiler by setting it to the system-wide default (using update-alternative). In this case, cmake generates make files that invoke the clang compiler.
I'm using Ubuntu 18.10 and clang 7.
I also tried this using clang-6 and setting cmake to generate ninja build scripts instead of make files, but the result is always the same.
The whole project compiles fine both with gcc as well as clang, before the fix is applied.
Please note that there is a similar discussion here, however the advice given there is to use run-clang-tidy.py, which is exactly what I'm doing. Therefore, I don't consider this a duplicate.