[PATCH] D135414: [clang][deps] Don't share in-memory VFS across scans

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 6 16:56:16 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 dependency scanning worker may create an in-memory VFS and inject that into its `FileManager`. (Implemented in D109485 <https://reviews.llvm.org/D109485>.) This VFS currently persists between scans, which is not correct: in-memory files created in one scan could affect subsequent scans. This patch changes things so that the in-memory VFS is local to `DependencyScanningWorker::computeDependencies()`.

To test this, one would first scan for dependencies of a named module and then run second scan (on the same worker) for something unrelated, which would pick up the in-memory file created in the first scan. This set up is impossible to achieve with `clang-scan-deps`. We could set this up in `ToolingTests`, but the scanner needs to access the physical filesystem to store `.pcm` files. AFAIK we don't have a good way to propagate something like `%t` into unit tests to make that feasible. (This could be achieved with something like the virtualized `OutputManager`.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135414

Files:
  clang/include/clang/Basic/FileManager.h
  clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135414.465932.patch
Type: text/x-patch
Size: 5482 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221006/ad08fb6b/attachment.bin>


More information about the cfe-commits mailing list