I ran clang-tidy
(Clang-Extra-Tools 6.0.0) in the root directory of the source code of an application (MPlayer-1.3.0
). Precisely, I use run-clang-tidy.py
python script, as follows:
run-clang-tidy.py -header-filter='.*' -checks='-*,readability-braces-around-statements' -fix
The commands database is also stored in the root directory in a file named compile_commands.json
. After gathering all fixes, it tries to apply them but no fix is applied on any of the source files compiled from the inner directories. Here is the first part of the error report:
Applying fixes ...
Described file './libavutil/internal.h' doesn't exist.
Ignoring...
Described file './libavutil/x86/intmath.h' doesn't exist.
Ignoring...
Described file 'libavformat/internal.h' doesn't exist.
Ignoring...
Described file './libavcodec/bytestream.h' doesn't exist.
Ignoring...
Described file './libavcodec/flac.h' doesn't exist.
Ignoring...
Described file './libavcodec/get_bits.h' doesn't exist.
Ignoring...
Described file './libavcodec/internal.h' doesn't exist.
Ignoring...
Described file './libavcodec/mathops.h' doesn't exist.
Ignoring...
Described file './libavcodec/put_bits.h' doesn't exist.
Ignoring...
Described file 'libavformat/matroskaenc.c' doesn't exist.
Ignoring...
Described file 'libavformat/subtitles.h' doesn't exist.
Ignoring...
Described file 'libavformat/apngdec.c' doesn't exist.
Ignoring...
...
These files are compiled using the Makefile located in the folder ffmpeg
. For example, libavformat/apngdec.c
is located at ./ffmpeg/libavformat/apngdec.c
where .
is the root directory of MPlayer-1.3.0
. How can I fix the problem?
In fact, it was a bug in
Clang Tidy
. It only happens in the case of exports. This happens in cases such as when therun-clang-tidy
script is called with-fix
switch. The main problem is that the fixes stored in the export file should use absolute paths. This usually happens with projects usingCMAKE
to generate the compile commands database. ButMPlayer
usesMakefile
as the build system and I usedBear
to generate the database. There are also problems with merging the fixes to the same location.To fix the problem, mainly, I constructed absolute paths and made some other changes similar to those for the code without export. Finally, the
YAML
export file is revised and generated. The patch is here.