代码之家  ›  专栏  ›  技术社区  ›  TheAhmad

在一个大项目上运行CLANG整洁

  •  1
  • TheAhmad  · 技术社区  · 6 年前

    我跑了 clang-tidy (clang extra tools 6.0.0)在应用程序源代码的根目录中( MPlayer-1.3.0 )。准确地说,我用 run-clang-tidy.py python脚本,如下所示:

    run-clang-tidy.py -header-filter='.*' -checks='-*,readability-braces-around-statements' -fix
    

    命令数据库也存储在根目录中名为 compile_commands.json .在收集所有修复程序之后,它将尝试应用这些修复程序,但不会对从中编译的任何源文件应用任何修复程序。 内部的 目录。以下是错误报告的第一部分:

    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...
    ...
    

    这些文件是使用文件夹中的makefile编译的。 ffmpeg .例如, libavformat/apngdec.c 位于 ./ffmpeg/libavformat/apngdec.c 在哪里? . 是的根目录 MPlayer-1.3.0层 .我怎样才能解决这个问题?

    1 回复  |  直到 6 年前
        1
  •  1
  •   TheAhmad    6 年前

    事实上,它是 Clang Tidy .它只发生在出口的情况下。这种情况发生在 run-clang-tidy 使用调用脚本 -fix 开关。主要问题是存储在导出文件中的修复程序应该使用绝对路径。这通常发生在使用 CMAKE 生成编译命令数据库。但是 MPlayer 使用 Makefile 作为构建系统,我使用 Bear 生成数据库。将修复程序合并到同一位置也存在问题。

    主要是为了解决这个问题,我构建了绝对路径,并做了一些与不导出代码类似的其他更改。最后, YAML 导出文件被修改并生成。补丁是 here .