[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:06:08 PDT 2022
jansvoboda11 created this revision.
jansvoboda11 added reviewers: Bigcheese, benlangmuir.
Herald added a subscriber: ributzka.
Herald added a project: All.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
The `-ivfsoverlay` flag was only being respected when the scanner was instructed to minimize the inputs. This patch respects that flag even in canonical preprocessing mode.
Depends on D135414 <https://reviews.llvm.org/D135414>.
Repository:
rG LLVM Github Monorepo
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135416.465935.patch
Type: text/x-patch
Size: 1444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221007/e5ce5a01/attachment.bin>
More information about the cfe-commits
mailing list