[PATCH] D60786: [FileSystemStatCache] Update test for new FileSystemStatCache API

Harlan Haskins via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 16 10:57:07 PDT 2019


harlanhaskins created this revision.
harlanhaskins added a reviewer: arphaman.
Herald added subscribers: cfe-commits, dexonsmith.
Herald added a project: clang.
arphaman accepted this revision.
arphaman added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: ormris.

LG


Update this test to return std::error_code instead of LookupResult.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D60786

Files:
  clang/unittests/Basic/FileManagerTest.cpp


Index: clang/unittests/Basic/FileManagerTest.cpp
===================================================================
--- clang/unittests/Basic/FileManagerTest.cpp
+++ clang/unittests/Basic/FileManagerTest.cpp
@@ -57,9 +57,10 @@
   }
 
   // Implement FileSystemStatCache::getStat().
-  LookupResult getStat(StringRef Path, llvm::vfs::Status &Status, bool isFile,
-                       std::unique_ptr<llvm::vfs::File> *F,
-                       llvm::vfs::FileSystem &FS) override {
+  std::error_code getStat(StringRef Path, llvm::vfs::Status &Status,
+                          bool isFile,
+                          std::unique_ptr<llvm::vfs::File> *F,
+                          llvm::vfs::FileSystem &FS) override {
 #ifndef _WIN32
     SmallString<128> NormalizedPath(Path);
     llvm::sys::path::native(NormalizedPath);
@@ -68,10 +69,10 @@
 
     if (StatCalls.count(Path) != 0) {
       Status = StatCalls[Path];
-      return CacheExists;
+      return std::error_code();
     }
 
-    return CacheMissing;  // This means the file/directory doesn't exist.
+    return std::make_error_code(std::errc::no_such_file_or_directory);
   }
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60786.195416.patch
Type: text/x-patch
Size: 1152 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190416/12e5b468/attachment.bin>


More information about the cfe-commits mailing list