#include "clang/Basic/FileManager.h"
#include "clang/Basic/FileSystemStatCache.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdint>
#include <cstdlib>
#include <optional>
#include <string>
#include <utility>
usingnamespaceclang;
#define DEBUG_TYPE …
FileManager::FileManager(const FileSystemOptions &FSO,
IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS)
: … { … }
FileManager::~FileManager() = default;
void FileManager::setStatCache(std::unique_ptr<FileSystemStatCache> statCache) { … }
void FileManager::clearStatCache() { … }
static llvm::Expected<DirectoryEntryRef>
getDirectoryFromFile(FileManager &FileMgr, StringRef Filename,
bool CacheFailure) { … }
DirectoryEntry *&FileManager::getRealDirEntry(const llvm::vfs::Status &Status) { … }
void FileManager::addAncestorsAsVirtualDirs(StringRef Path) { … }
llvm::Expected<DirectoryEntryRef>
FileManager::getDirectoryRef(StringRef DirName, bool CacheFailure) { … }
llvm::ErrorOr<const DirectoryEntry *>
FileManager::getDirectory(StringRef DirName, bool CacheFailure) { … }
llvm::ErrorOr<const FileEntry *>
FileManager::getFile(StringRef Filename, bool openFile, bool CacheFailure) { … }
llvm::Expected<FileEntryRef>
FileManager::getFileRef(StringRef Filename, bool openFile, bool CacheFailure) { … }
llvm::Expected<FileEntryRef> FileManager::getSTDIN() { … }
void FileManager::trackVFSUsage(bool Active) { … }
const FileEntry *FileManager::getVirtualFile(StringRef Filename, off_t Size,
time_t ModificationTime) { … }
FileEntryRef FileManager::getVirtualFileRef(StringRef Filename, off_t Size,
time_t ModificationTime) { … }
OptionalFileEntryRef FileManager::getBypassFile(FileEntryRef VF) { … }
bool FileManager::FixupRelativePath(SmallVectorImpl<char> &path) const { … }
bool FileManager::makeAbsolutePath(SmallVectorImpl<char> &Path) const { … }
void FileManager::fillRealPathName(FileEntry *UFE, llvm::StringRef FileName) { … }
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
FileManager::getBufferForFile(FileEntryRef FE, bool isVolatile,
bool RequiresNullTerminator,
std::optional<int64_t> MaybeLimit) { … }
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
FileManager::getBufferForFileImpl(StringRef Filename, int64_t FileSize,
bool isVolatile,
bool RequiresNullTerminator) const { … }
std::error_code
FileManager::getStatValue(StringRef Path, llvm::vfs::Status &Status,
bool isFile, std::unique_ptr<llvm::vfs::File> *F) { … }
std::error_code
FileManager::getNoncachedStatValue(StringRef Path,
llvm::vfs::Status &Result) { … }
void FileManager::GetUniqueIDMapping(
SmallVectorImpl<OptionalFileEntryRef> &UIDToFiles) const { … }
StringRef FileManager::getCanonicalName(DirectoryEntryRef Dir) { … }
StringRef FileManager::getCanonicalName(FileEntryRef File) { … }
StringRef FileManager::getCanonicalName(const void *Entry, StringRef Name) { … }
void FileManager::AddStats(const FileManager &Other) { … }
void FileManager::PrintStats() const { … }