[PATCH] D68193: In openFileForRead don't cache erroneous entries if the error relates to them being directories. Add tests.

Kousik Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 30 12:19:45 PDT 2019


kousikk marked 3 inline comments as done.
kousikk added inline comments.


================
Comment at: clang/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp:236-237
     if (!CacheEntry.isValid()) {
+      llvm::vfs::FileSystem &FS = getUnderlyingFS();
+      auto MaybeStatus = FS.status(Filename);
+
----------------
dexonsmith wrote:
> It seems wasteful to do an extra stat here when the file is already open in `createFileEntry`.
> 
> Can you instead change `createFileEntry` to return `std::errc::is_a_directory` as appropriate to avoid the extra filesystem access?  (Is it possible that it's already doing that, and you just need to check for that?)
Thanks for the suggestion, done.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68193





More information about the cfe-commits mailing list