c++ - Getting clang-tidy to fix header files -
i'm in process of moving project compiling gcc clang, , have bunch of warnings gcc didn't generate (-winconsistent-missing-override
). clang-tidy
works fixing these errors in *.cpp
files, doesn't touch hpp
files because compile command wasn't found in database (as expect).
i'm using ninja
build project , ninja -t compdb cc cxx > .build/compile_commands.json
generate compilation database. i've tried running:
clang-tidy-3.6 -p .build/ \ $(find src/ -name *.cpp) \ $(find src/ -name *.hpp) \ --checks=misc-use-override --fix
to fix errors. refuses touch header files complaining:
skipping .../src/header/file.hpp. compile command not found.
i got working specifying --header-filter=src/
option. interestingly fixes ended being applied several times causing output this:
void f() override override override override override;
i worked around running clang-tidy
on each source file separately. note <build-path>
specified -p
must contain .clang-format
configuration styling applied.
this current iteration of command:
find src/ -name '*.cpp' -exec \ clang-tidy-3.6 -p . --header-filter=src/ {} --checks=misc-use-override --fix
Comments
Post a Comment