[PATCH] D135416: [clang][deps] Respect VFS overlays in canonical preprocessing mode

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 6 17:07:56 PDT 2022


jansvoboda11 updated this revision to Diff 465936.
jansvoboda11 added a comment.

Add forgotten hunk.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135416/new/

https://reviews.llvm.org/D135416

Files:
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
  clang/test/ClangScanDeps/vfsoverlay.cpp


Index: clang/test/ClangScanDeps/vfsoverlay.cpp
===================================================================
--- clang/test/ClangScanDeps/vfsoverlay.cpp
+++ clang/test/ClangScanDeps/vfsoverlay.cpp
@@ -8,8 +8,8 @@
 // RUN: cp %S/Inputs/header.h %t.dir/Inputs/header.h
 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/vfsoverlay_cdb.json > %t.cdb
 //
-// RUN: clang-scan-deps -compilation-database %t.cdb -j 1 | \
-// RUN:   FileCheck %s
+// RUN: clang-scan-deps -compilation-database %t.cdb -mode preprocess-dependency-directives -j 1 | FileCheck %s
+// RUN: clang-scan-deps -compilation-database %t.cdb -mode preprocess                       -j 1 | FileCheck %s
 
 #include "not_real.h"
 
Index: clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
===================================================================
--- clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -192,6 +192,11 @@
     ScanInstance.getFrontendOpts().ModulesShareFileManager = false;
 
     ScanInstance.setFileManager(FileMgr);
+    // Support for virtual file system overlays.
+    FileMgr->setVirtualFileSystem(createVFSFromCompilerInvocation(
+        ScanInstance.getInvocation(), ScanInstance.getDiagnostics(),
+        FileMgr->getVirtualFileSystemPtr()));
+
     ScanInstance.createSourceManager(*FileMgr);
 
     llvm::StringSet<> PrebuiltModulesInputFiles;
@@ -206,12 +211,6 @@
 
     // Use the dependency scanning optimized file system if requested to do so.
     if (DepFS) {
-      // Support for virtual file system overlays on top of the caching
-      // filesystem.
-      FileMgr->setVirtualFileSystem(createVFSFromCompilerInvocation(
-          ScanInstance.getInvocation(), ScanInstance.getDiagnostics(),
-          FileMgr->getVirtualFileSystemPtr()));
-
       llvm::IntrusiveRefCntPtr<DependencyScanningWorkerFilesystem> LocalDepFS =
           DepFS;
       ScanInstance.getPreprocessorOpts().DependencyDirectivesForFile =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135416.465936.patch
Type: text/x-patch
Size: 2025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221007/2fea922b/attachment-0001.bin>


More information about the cfe-commits mailing list