hanchenye-llvm-project/clang/tools
Jan Svoboda b8b14b682c [clang][deps] Make resource directory deduction configurable
The `clang-scan-deps` CLI tool invokes the compiler with `-print-resource-dir` in case the `-resource-dir` argument is missing from the compilation command line. This is to enable running the tool on compilation databases that use compiler from a different toolchain than `clang-scan-deps` itself. While this doesn't make sense when scanning modular builds (due to the `-cc1` arguments the tool generates), the tool can can be used to efficiently scan for file dependencies of non-modular builds too.

This patch stops deducing the resource directory by invoking the compiler by default. This mode can still be enabled by invoking `clang-scan-deps` with `--resource-dir-recipe invoke-compiler`. The new default is `--resource-dir-recipe modify-compiler-path` which relies on the resource directory deduction taking place in `Driver::Driver` which is based on the compiler path. This makes the default more aligned with the intended usage of the tool while still allowing it to serve other use-cases.

Note that this functionality was also influenced by D108979, where the dependency scanner stopped going through `ClangTool::run`. The function tried to deduce the resource directory based on the current executable path, which might not be what the users expect when invoked from within a shared library.

Depends on D108979.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D108366
2021-10-21 14:06:52 +02:00
..
amdgpu-arch [amdgpu-arch] Guard hsa.h with __has_include 2021-05-10 07:33:30 +00:00
apinotes-test [Support] Don't include VirtualFileSystem.h in CommandLine.h 2021-04-21 10:19:01 -04:00
arcmt-test [NFC] Reordering parameters in getFile and getFileOrSTDIN 2021-03-25 09:47:49 -04:00
c-arcmt-test
c-index-test [CMake] Consistently use the LibXml2::LibXml2 target instead of LIBXML2_LIBRARIES 2021-09-25 13:13:11 +02:00
clang-check
clang-diff
clang-extdef-mapping
clang-format [clang-format] git-clang-format throws an assertion when removing files as part of the commit 2021-10-20 09:07:12 +01:00
clang-format-vs
clang-fuzzer Move TargetRegistry.(h|cpp) from Support to MC 2021-10-08 14:51:48 -07:00
clang-import-test Reland "[clang-repl] Implement partial translation units and error recovery." 2021-07-12 15:21:22 +00:00
clang-nvlink-wrapper [Clang][clang-nvlink-wrapper] Pass nvlink path to the wrapper 2021-10-12 16:15:52 +00:00
clang-offload-bundler [Clang][OpenMP] Add partial support for Static Device Libraries 2021-10-08 09:37:51 +00:00
clang-offload-wrapper [clang-offload-wrapper] Disabled ELF offload notes embedding by default. 2021-08-18 08:18:03 -07:00
clang-refactor Use ManagedStatic and lazy initialization of cl::opt in libSupport to make it free of global initializer 2021-07-16 07:38:16 +00:00
clang-rename
clang-repl Reland "[clang-repl] Allow loading of plugins in clang-repl." 2021-10-05 13:04:01 +00:00
clang-scan-deps [clang][deps] Make resource directory deduction configurable 2021-10-21 14:06:52 +02:00
clang-shlib [CMake] Don't use -Bsymbolic-functions for MinGW targets 2021-06-30 22:54:26 +03:00
diag-build [clang] Use portable "#!/usr/bin/env bash" shebang for tools and utils. 2021-09-23 21:16:43 +05:30
diagtool Reland "[clang-cl] Accept `#pragma warning(disable : N)` for some N" 2021-09-30 15:03:23 -04:00
driver Move TargetRegistry.(h|cpp) from Support to MC 2021-10-08 14:51:48 -07:00
libclang [clang] Use llvm::is_contained (NFC) 2021-10-13 20:41:55 -07:00
scan-build [clang] Update Clang version from 13 to 14 in scan-build.1. 2021-09-30 11:23:25 +05:30
scan-build-py Make analyze-cc path discovery sensible to symlinks 2021-09-27 08:35:19 +02:00
scan-view Partially Revert "scan-view: Remove Reporter.py and associated AppleScript files" 2021-02-11 19:10:46 -08:00
CMakeLists.txt [clang-nvlink-wrapper] Wrapper around nvlink for archive files 2021-09-01 16:00:29 +05:30