Getting clang-tidy to fix header files

非 Y 不嫁゛ 提交于 2019-12-05 00:44:48

I got it working by specifying the --header-filter=src/ option. Interestingly fixes ended up being applied several times causing output like this:

void f() override override override override override;

I worked around this by running clang-tidy on each source file separately. Also note the <build-path> specified with -p must also contain the .clang-format configuration for styling to be applied.

This is my current iteration of the command:

find src/ -name '*.cpp' -exec \
     clang-tidy-3.6 -p . --header-filter=src/ {}
               --checks=misc-use-override --fix

Be careful when using "-header-filter" correctly. There is no two "minus" characters before "header" ! Unlike in nishantjr reply.

As shown here : http://releases.llvm.org/3.9.0/tools/clang/tools/extra/docs/clang-tidy/index.html

This is still true in clang-tidy 9.0.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!