This patch stops lit from looking on the PATH for clang, lld and other users of use_llvm_tool (currently only the debuginfo-tests) unless the call explicitly requests to opt into using the PATH. When not opting in, tests will only look in the build directory.
See the mailing list thread starting from https://lists.llvm.org/pipermail/llvm-dev/2021-May/150421.html.
use_clang is used from:
- The main clang tests (we don't want to test the installed version here, only the built version).
- The debuginfo tests (this one is possibly debatable, but the conversation in D95339 suggests we should only use the build version in a monorepo setting; see also D96511).
- The clangd testing (although rGc29513f7e023f125c6d221db179dc40b79e5c074 suggests clang is not actually used).
- The lldb shell testing (this appears to deliberately allow using the installed version).
use_lld is used from:
- The main lld tests (we don't want to test the installed version here, only the built version).
- The lldb shell testing (this appears to deliberately allow using the installed version).
use_llvm_tool is used from:
- use_lld and use_clang
- The debuginfo_tests to lookup LLDB (see above reasoning for clang)
- The tests for lit itself (not in a way where the behaviour change is relevant)