15 #include "llvm/Support/Chrono.h" 16 #include "llvm/Support/ErrorOr.h" 17 #include "llvm/Support/Path.h" 18 #include "llvm/Support/VirtualFileSystem.h" 21 using namespace clang;
23 void FileSystemStatCache::anchor() {}
27 Data.
Name = Status.getName();
28 Data.
Size = Status.getSize();
29 Data.
ModTime = llvm::sys::toTimeT(Status.getLastModificationTime());
30 Data.
UniqueID = Status.getUniqueID();
32 Data.
IsNamedPipe = Status.getType() == llvm::sys::fs::file_type::fifo_file;
47 std::unique_ptr<llvm::vfs::File> *F,
49 llvm::vfs::FileSystem &FS) {
51 bool isForDir = !isFile;
55 R = Cache->
getStat(Path, Data, isFile, F, FS);
56 else if (isForDir || !F) {
59 llvm::ErrorOr<llvm::vfs::Status> Status = FS.status(Path);
74 auto OwnedFile = FS.openFileForRead(Path);
83 llvm::ErrorOr<llvm::vfs::Status> Status = (*OwnedFile)->status();
87 *F = std::move(*OwnedFile);
115 std::unique_ptr<llvm::vfs::File> *F,
116 llvm::vfs::FileSystem &FS) {
117 if (
get(Path, Data, isFile, F,
nullptr, FS)) {
126 if (!Data.
IsDirectory || llvm::sys::path::is_absolute(Path))
127 StatCalls[Path] = Data;
Defines the FileSystemStatCache interface.
We know the file exists and its cached stat data.
We know that the file doesn't exist.
Abstract interface for introducing a FileManager cache for 'stat' system calls, which is used by prec...
static bool get(StringRef Path, FileData &Data, bool isFile, std::unique_ptr< llvm::vfs::File > *F, FileSystemStatCache *Cache, llvm::vfs::FileSystem &FS)
Get the 'stat' information for the specified path, using the cache to accelerate it if possible...
virtual LookupResult getStat(StringRef Path, FileData &Data, bool isFile, std::unique_ptr< llvm::vfs::File > *F, llvm::vfs::FileSystem &FS)=0
llvm::sys::fs::UniqueID UniqueID
LookupResult getStat(StringRef Path, FileData &Data, bool isFile, std::unique_ptr< llvm::vfs::File > *F, llvm::vfs::FileSystem &FS) override
Dataflow Directional Tag Classes.
static void copyStatusToFileData(const llvm::vfs::Status &Status, FileData &Data)