[llvm] [Bazel][Clang Tidy] Include builtin headers with clang-tidy (PR #67626)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 10:26:43 PST 2024


aeubanks wrote:

Just checked our internal bazel build, and it's the same issue, a just-built clang without any setting up can't find system headers. We have to copy all built binaries/libraries into a certain directory structure as a separate build step to roughly match the CMake build. Either you can do that as a separate step outside of bazel, or have bazel setup the proper directory structure, but this PR is very specific to clang-tidy and I'd rather see a more complete and maintainable solution.

For example, the gn build has a [rule](https://github.com/llvm/llvm-project/blob/d39d5ccbc0c3ea6aca68e46ff9f4503b682d1ac2/llvm/utils/gn/secondary/clang/lib/Headers/BUILD.gn#L87) to copy headers to a specific directory to mirror the CMake build, and by default it puts executables in `$build_dir/bin`, which also mirrors the CMake build. In contrast, this PR creates a symlink to headers that only works for clang-tidy, and sort of by happenstance as I've mentioned before, which is too hacky for my taste.

Perhaps @rupprecht has some thoughts, I believe he's been doing something similar recently.

https://github.com/llvm/llvm-project/pull/67626


More information about the llvm-commits mailing list