[clang] [clang-scan-deps] Infer the tool locations from PATH (PR #108539)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 13 08:17:33 PDT 2024


mstorsjo wrote:

> Can you explain why exactly is this necessary/beneficial? If the compilation database got created with just the tool name, I'd expect the rest of the build to be able to use just the tool name when the scanner spits it out again, no? If this is about the scanner finding the right config, sysroot, resource directory, etc., I'd expect that to already happen, since the scanner needs to be colocated with the toolchain itself (since `clang` and `clang-scan-deps` are effectively version-locked).

It's about the scanner finding the right config files and sysroot.

Even if `clang-scan-deps` is colocated with the toolchain, the tool never assumes that. Normally when you invoke `clang` to compile, it sets the executable directory so that within the `clang::Driver` class, `Dir` points to where clang resides.

Now when `clang-scan-deps` inspects one or more `clang` tool invocations, the `clang::Driver` class never gets set up with the `Dir` of the `clang-scan-deps` executable - it only sets things based on what it literally sees in the command lines, without any outside assumptions about default directory.

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


More information about the cfe-commits mailing list