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
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:
}
// 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
#endif
if (StatCalls.count(Path) != 0) {
- Data = StatCalls[Path];
+ Status = StatCalls[Path];
return CacheExists;
}