| 50 | VFS(IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs, PreambleStatCache &cache) |
| 51 | : ProxyFileSystem(std::move(fs)), cache(cache) {} |
| 52 | llvm::ErrorOr<std::unique_ptr<llvm::vfs::File>> openFileForRead(const Twine &path) override { |
| 53 | auto file = getUnderlyingFS().openFileForRead(path); |
| 54 | if (!file || !*file) |
| 55 | return file; |
| 56 | cache.update(path, file->get()->status()); |
| 57 | return file; |
| 58 | } |
| 59 | llvm::ErrorOr<llvm::vfs::Status> status(const Twine &path) override { |
| 60 | auto s = getUnderlyingFS().status(path); |
| 61 | cache.update(path, s); |