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

Arthur Eubanks via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 23 14:33:25 PDT 2023


aeubanks wrote:

I think there are two approaches to this problem
1) point `-resource-dir` to the directory where the headers are, e.g. `clang-tidy --extra-arg=-resource-dir=path/to/include`
2) mirror the CMake binary/include layout (this patch)

issues with 1: extra argument to pass, have to figure out include path to pass
issues with 2: relies on bazel paths, i.e. this puts the symlink at `bazel-bin/external/llvm-project/clang-tools-extra/` which happens to be two directories up from `bazel-bin/external/llvm-project/clang-tools-extra/clang-tidy/clang-tidy`

for 1, I'm not sure how hard it is in bazel to get the path for where we put the builtins
for 2, is it possible to explicitly copy clang-tidy and the headers to a path that mirrors the CMake build? e.g. put `clang-tidy` in a `bin/` dir and the headers in `lib/clang/18/include`. or is that too un-bazel-like? the gn build does this.

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


More information about the cfe-commits mailing list