[all-commits] [llvm/llvm-project] b8b14b: [clang][deps] Make resource directory deduction co...
Jan Svoboda via All-commits
all-commits at lists.llvm.org
Thu Oct 21 05:07:06 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b8b14b682c339c9ab85360d24ba9b888d52fdfbb
https://github.com/llvm/llvm-project/commit/b8b14b682c339c9ab85360d24ba9b888d52fdfbb
Author: Jan Svoboda <jan_svoboda at apple.com>
Date: 2021-10-21 (Thu, 21 Oct 2021)
Changed paths:
A clang/test/ClangScanDeps/Inputs/resource_directory/cdb.json.template
A clang/test/ClangScanDeps/Inputs/resource_directory/compiler
A clang/test/ClangScanDeps/Inputs/resource_directory/mod.h
A clang/test/ClangScanDeps/Inputs/resource_directory/module.modulemap
A clang/test/ClangScanDeps/Inputs/resource_directory/tu.c
A clang/test/ClangScanDeps/resource_directory.c
M clang/tools/clang-scan-deps/ClangScanDeps.cpp
Log Message:
-----------
[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
More information about the All-commits
mailing list