[PATCH] D108366: [clang][deps] Deduce resource directory from the compiler path
Jan Svoboda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 19 04:53:06 PDT 2021
jansvoboda11 created this revision.
jansvoboda11 added reviewers: Bigcheese, dexonsmith, arphaman, kousikk.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
After [[libclang][deps] Accept only driver invocations, don't modify them](https://github.com/apple/llvm-project/pull/3168) landed downstream, the libclang dependency scanner stopped deducing the resource directory based on the compiler executable path (in `Driver::Driver` called by `createInvocationFromCommandLine` called by `getFileDependencies`) and started using the current executable path (injected in `ClangTool::run`). However, the current executable is potentially a build system located outside the compiler toolchain that loaded the libclang shared library.
This patch adds an option to `ClangTool` to disable the deduction of the resource directory. This means the dependency scanner (both `clang-scan-deps` and libclang) now base the deduction on the compiler executable provided as part of the compilation command-line (in `Driver::Driver` called by `ToolInvocation::run` called by `ClangTool::run`).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D108366
Files:
clang/include/clang/Tooling/Tooling.h
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
clang/lib/Tooling/Tooling.cpp
clang/test/ClangScanDeps/Inputs/resource_directory/cdb_tu.json
clang/test/ClangScanDeps/Inputs/resource_directory/mod.h
clang/test/ClangScanDeps/Inputs/resource_directory/module.modulemap
clang/test/ClangScanDeps/Inputs/resource_directory/tu.c
clang/test/ClangScanDeps/resource_directory.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108366.367460.patch
Type: text/x-patch
Size: 5602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210819/b756ec4e/attachment.bin>
More information about the cfe-commits
mailing list