================
@@ -102,7 +94,18 @@ bool DependencyScanningWorker::scanDependencies(
StringRef WorkingDirectory, const std::vector<std::string> &CommandLine,
DependencyConsumer &Consumer, DependencyActionController &Controller,
DiagnosticConsumer &DC,
- llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS) {
+ IntrusiveRefCntPtr<llvm::vfs::FileSystem> OverlayFS) {
+ IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS = DepFS;
+ if (OverlayFS) {
+#ifndef NDEBUG
+ bool SawDepFS = false;
+ OverlayFS->visit(
+ [&](llvm::vfs::FileSystem &VFS) { SawDepFS |= &VFS == DepFS.get(); });
+ assert(SawDepFS && "OverlayFS not based on DepFS");
+#endif
+ FS = std::move(OverlayFS);
+ }
+
DignosticsEngineWithDiagOpts DiagEngineWithCmdAndOpts(CommandLine, FS, DC);
DependencyScanningAction Action(Service, WorkingDirectory, Consumer,
Controller, DepFS);
----------------
qiongsiwu wrote:
Oh I see that makes sense! Thanks for clarifying!
> (Or maybe we could make FS a scanner-specific VFS
> CustomizedDependencyScanningWorkerFileSystem that provides
> DependencyScanningWorkerFilesystem &getDepFS() instead, to avoid the
> visitation.)
Yeah this sounds good! Visitation _feels_ expensive. I don't think we need to
do this soon or in this PR though as this is NFC.
https://github.com/llvm/llvm-project/pull/168970
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits