diff options
author | Harlan Haskins <harlan@harlanhaskins.com> | 2019-03-05 02:27:12 +0000 |
---|---|---|
committer | Harlan Haskins <harlan@harlanhaskins.com> | 2019-03-05 02:27:12 +0000 |
commit | 06f64d53ae5f616e5b860783991844665556064d (patch) | |
tree | 4a4acedb96226ed9fdd28f8a1096b4f3fb9d6592 /clang/unittests/Basic/FileManagerTest.cpp | |
parent | 1c014d75b4cdcfab5cef304e5f9c5def96468751 (diff) | |
download | llvm-06f64d53ae5f616e5b860783991844665556064d.zip llvm-06f64d53ae5f616e5b860783991844665556064d.tar.gz llvm-06f64d53ae5f616e5b860783991844665556064d.tar.bz2 |
Replace clang::FileData with llvm::vfs::Status
Summary:
FileData was only ever used as a container for the values in
llvm::vfs::Status, so they might as well be consolidated.
The `InPCH` member was also always set to false, and unused.
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58924
llvm-svn: 355368
Diffstat (limited to 'clang/unittests/Basic/FileManagerTest.cpp')
-rw-r--r-- | clang/unittests/Basic/FileManagerTest.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/clang/unittests/Basic/FileManagerTest.cpp b/clang/unittests/Basic/FileManagerTest.cpp index 866859a..c9dfbd6 100644 --- a/clang/unittests/Basic/FileManagerTest.cpp +++ b/clang/unittests/Basic/FileManagerTest.cpp @@ -26,7 +26,7 @@ class FakeStatCache : public FileSystemStatCache { private: // Maps a file/directory path to its desired stat result. Anything // not in this map is considered to not exist in the file system. - llvm::StringMap<FileData, llvm::BumpPtrAllocator> StatCalls; + llvm::StringMap<llvm::vfs::Status, llvm::BumpPtrAllocator> StatCalls; void InjectFileOrDirectory(const char *Path, ino_t INode, bool IsFile) { #ifndef _WIN32 @@ -35,15 +35,14 @@ private: Path = NormalizedPath.c_str(); #endif - FileData Data; - Data.Name = Path; - Data.Size = 0; - Data.ModTime = 0; - Data.UniqueID = llvm::sys::fs::UniqueID(1, INode); - Data.IsDirectory = !IsFile; - Data.IsNamedPipe = false; - Data.InPCH = false; - StatCalls[Path] = Data; + auto fileType = IsFile ? + llvm::sys::fs::file_type::regular_file : + llvm::sys::fs::file_type::directory_file; + llvm::vfs::Status Status(Path, llvm::sys::fs::UniqueID(1, INode), + /*MTime*/{}, /*User*/0, /*Group*/0, + /*Size*/0, fileType, + llvm::sys::fs::perms::all_all); + StatCalls[Path] = Status; } public: @@ -58,7 +57,7 @@ public: } // Implement FileSystemStatCache::getStat(). - LookupResult getStat(StringRef Path, FileData &Data, bool isFile, + LookupResult getStat(StringRef Path, llvm::vfs::Status &Status, bool isFile, std::unique_ptr<llvm::vfs::File> *F, llvm::vfs::FileSystem &FS) override { #ifndef _WIN32 @@ -68,7 +67,7 @@ public: #endif if (StatCalls.count(Path) != 0) { - Data = StatCalls[Path]; + Status = StatCalls[Path]; return CacheExists; } |