r358511 - [FileSystemStatCache] Update test for new FileSystemStatCache API

Harlan Haskins via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 16 11:00:44 PDT 2019


Author: harlanhaskins
Date: Tue Apr 16 11:00:43 2019
New Revision: 358511

URL: http://llvm.org/viewvc/llvm-project?rev=358511&view=rev
Log:
[FileSystemStatCache] Update test for new FileSystemStatCache API

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

Reviewers: arphaman

Subscribers: dexonsmith, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D60786

Modified:
    cfe/trunk/unittests/Basic/FileManagerTest.cpp

Modified: cfe/trunk/unittests/Basic/FileManagerTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/FileManagerTest.cpp?rev=358511&r1=358510&r2=358511&view=diff
==============================================================================
--- cfe/trunk/unittests/Basic/FileManagerTest.cpp (original)
+++ cfe/trunk/unittests/Basic/FileManagerTest.cpp Tue Apr 16 11:00:43 2019
@@ -57,9 +57,10 @@ public:
   }
 
   // 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 @@ public:
 
     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);
   }
 };
 




More information about the cfe-commits mailing list