OpenROAD icon indicating copy to clipboard operation
OpenROAD copied to clipboard

Generate compile.json from the bazel build for clang-tidy

Open maliberty opened this issue 2 months ago • 7 comments

Description

Needs to replace this being generated by cmake

Suggested Solution

No response

Additional Context

No response

maliberty avatar Oct 08 '25 20:10 maliberty

I can take this

hzeller avatar Oct 11 '25 06:10 hzeller

Does clang-tidy need to run in the sandbox from bazel? I wonder if the compile.json will point to files that are removed when the sandbox is cleaned up.

maliberty avatar Oct 16 '25 16:10 maliberty

@QuantamHD suggests https://github.com/hedronvision/bazel-compile-commands-extractor

maliberty avatar Oct 16 '25 23:10 maliberty

Whenever I tried, I never had good experience with the hedronvision tool.

I'll built something with bant that works pretty well, and is maintained by someone close to the team. Probably this weekend.

hzeller avatar Oct 17 '25 06:10 hzeller

https://bazel.build/install/ide#autocomplete-for-source-code has additional options.

Though if this is only for clang-tidy, then something like: https://github.com/erenon/bazel_clang_tidy

can be used without needing a compile.json file.

hongted avatar Nov 17 '25 19:11 hongted

It is only for clang_tidy afaik.

maliberty avatar Nov 17 '25 21:11 maliberty

I also use the compilation DB for support for clangd, this is why I prefer using bant to create a compilation DB. Also, if we use our clang-tidy script, it has more sophisticated caching than what bazel can provide, so it is also nicer.

I have a week of vacation now, so I might get to it.

hzeller avatar Nov 17 '25 21:11 hzeller