[PATCH] D78058: option to write files to memory instead of disk

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 17 17:12:36 PST 2020


sammccall added a comment.

It's great that you're looking at this! Clang tooling in general and clangd in particular a lot of use of VFS (particularly when deployed inside google), so I've got a fair bit of interest/experience in these interfaces. And we'd also looked at virtualizing module caches in particular for clangd (but haven't tackled it yet).

A couple of high-level design questions:

- if the goal is really to make module caching work without a physical disk, is virtualizing the FS underlying the cache really the right abstraction? Compared to an alternative like plugging in a ModuleCache interface, it seems like quite a complicated contract to have to maintain, and less flexible too (we've dreamed about ideas like a network-distributed cache, expiry, selectively sharing cached modules based on security context etc... easier if the objects are modules+metadata rather than filenames+bytes). Of course it's pretty generic and maybe can be used for other stuff too, but...
- if we *are* going to introduce a writable VFS concept to LLVM, I feel we must allow this to be reused for virtualizing file writes in general. (clang has several ad-hoc mechanisms for virtual file inputs that AIUI predate llvm::vfs, and they're a pain). I think at minimum we should ensure that the writable FS is an interface rather than just one implementation, and that we can implement it well for the real FS also. Does this seem reasonable?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78058



More information about the cfe-commits mailing list