//===- FileSystemStatCache.cpp - Caching for 'stat' calls -----------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file defines the FileSystemStatCache interface. // //===----------------------------------------------------------------------===// #include "clang/Basic/FileSystemStatCache.h" #include "llvm/Support/Chrono.h" #include "llvm/Support/ErrorOr.h" #include "llvm/Support/Path.h" #include "llvm/Support/VirtualFileSystem.h" #include <utility> usingnamespaceclang; void FileSystemStatCache::anchor() { … } /// FileSystemStatCache::get - Get the 'stat' information for the specified /// path, using the cache to accelerate it if possible. This returns true if /// the path does not exist or false if it exists. /// /// If isFile is true, then this lookup should only return success for files /// (not directories). If it is false this lookup should only return /// success for directories (not files). On a successful file lookup, the /// implementation can optionally fill in FileDescriptor with a valid /// descriptor and the client guarantees that it will close it. std::error_code FileSystemStatCache::get(StringRef Path, llvm::vfs::Status &Status, bool isFile, std::unique_ptr<llvm::vfs::File> *F, FileSystemStatCache *Cache, llvm::vfs::FileSystem &FS) { … } std::error_code MemorizeStatCalls::getStat(StringRef Path, llvm::vfs::Status &Status, bool isFile, std::unique_ptr<llvm::vfs::File> *F, llvm::vfs::FileSystem &FS) { … }