[clang] [clang] Only set non-empty bypass to scan VFS (PR #159605)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 18 10:06:59 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Jan Svoboda (jansvoboda11)
<details>
<summary>Changes</summary>
Normalizing an empty modules cache path results in an incorrect non-empty path (the working directory). This PR conditionalizes more code to avoid this. Tested downstream by swift/llvm-project and the `DependencyScanningCAPITests.DependencyScanningFSCacheOutOfDate` unit test.
---
Full diff: https://github.com/llvm/llvm-project/pull/159605.diff
1 Files Affected:
- (modified) clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp (+6-5)
``````````diff
diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
index 0a12c479bf8e3..16cb56fddc006 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -445,13 +445,14 @@ class DependencyScanningAction {
// Use the dependency scanning optimized file system if requested to do so.
if (DepFS) {
- SmallString<256> ModulesCachePath;
- normalizeModuleCachePath(
- *FileMgr, ScanInstance.getHeaderSearchOpts().ModuleCachePath,
- ModulesCachePath);
DepFS->resetBypassedPathPrefix();
- if (!ModulesCachePath.empty())
+ if (!ScanInstance.getHeaderSearchOpts().ModuleCachePath.empty()) {
+ SmallString<256> ModulesCachePath;
+ normalizeModuleCachePath(
+ *FileMgr, ScanInstance.getHeaderSearchOpts().ModuleCachePath,
+ ModulesCachePath);
DepFS->setBypassedPathPrefix(ModulesCachePath);
+ }
ScanInstance.setDependencyDirectivesGetter(
std::make_unique<ScanningDependencyDirectivesGetter>(*FileMgr));
``````````
</details>
https://github.com/llvm/llvm-project/pull/159605
More information about the cfe-commits
mailing list