[PATCH] D52620: Added Support for StatOnly Files in VFS.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 28 02:48:03 PDT 2018


sammccall added a comment.

Could you give some more detail about what this is for?

- it sounds like this is for record-replay. In the replayed compilation, we assume the accessed files are the same, is it safe to assume we never read files we previously stat()ed? What are these files in practice?
- it seems like this could also be achieved with an overlayFS adding a simple specialized FS that only provides the stat-only files. If this is a relatively niche feature, cramming it into InMemoryFileSystem may not be the best option. Any thoughts on the tradeoff here?



================
Comment at: include/clang/Basic/VirtualFileSystem.h:414
+  // Add a file with the given size but with no contents. The buffer of this
+  // file must never be requested.
+  /// \return true if the file successfully added, false if the file already
----------------
Please add some motivation here, e.g. "such files are useful when replaying a recorded compilation, if the original compilation never read the file contents"


================
Comment at: lib/Basic/VirtualFileSystem.cpp:495
   std::unique_ptr<llvm::MemoryBuffer> Buffer;
+  bool StatOnlyFile;
 
----------------
can't you just represent this by a null buffer?


Repository:
  rC Clang

https://reviews.llvm.org/D52620





More information about the cfe-commits mailing list