Generate compile_commands.json
and run clang-tidy with Bazel.
This is an adaptation of Kythe's approach with a small patch to support the latest version of Bazel.
- Append
WORKSPACE
to your repository'sWORKSPACE
file. - Copy
third_party
to your repository directory. - Optionally replace
'kind(cc_.*, //...)'
inthird_party/tools/generate_compilation_database.sh
.
To generate a compile_commands.json
file in $(bazel info execution_root)
, run third_party/tools/generate_compilation_database.sh
.
To use clang-tidy
, run third_party/tools/clang_tidy.sh
.
Tested with Bazel 0.27.0.