diff options
Diffstat (limited to 'include/clang/Basic/FileManager.h')
-rw-r--r-- | include/clang/Basic/FileManager.h | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/include/clang/Basic/FileManager.h b/include/clang/Basic/FileManager.h index e7891baf53..96983475f4 100644 --- a/include/clang/Basic/FileManager.h +++ b/include/clang/Basic/FileManager.h @@ -1,9 +1,8 @@ //===--- FileManager.h - File System Probing and Caching --------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// /// @@ -68,17 +67,15 @@ class FileEntry { unsigned UID; // A unique (small) ID for the file. llvm::sys::fs::UniqueID UniqueID; bool IsNamedPipe; - bool InPCH; bool IsValid; // Is this \c FileEntry initialized and valid? - bool DeferredOpen; // Created by getFile(OpenFile=0); may open later. /// The open file, if it is owned by the \p FileEntry. mutable std::unique_ptr<llvm::vfs::File> File; public: FileEntry() - : UniqueID(0, 0), IsNamedPipe(false), InPCH(false), IsValid(false), - DeferredOpen(false) {} + : UniqueID(0, 0), IsNamedPipe(false), IsValid(false) + {} FileEntry(const FileEntry &) = delete; FileEntry &operator=(const FileEntry &) = delete; @@ -89,7 +86,6 @@ public: off_t getSize() const { return Size; } unsigned getUID() const { return UID; } const llvm::sys::fs::UniqueID &getUniqueID() const { return UniqueID; } - bool isInPCH() const { return InPCH; } time_t getModificationTime() const { return ModTime; } /// Return the directory the file lives in. @@ -110,8 +106,6 @@ public: bool isOpenForTests() const { return File != nullptr; } }; -struct FileData; - /// Implements support for file system lookup, file system caching, /// and directory search management. /// @@ -170,7 +164,7 @@ class FileManager : public RefCountedBase<FileManager> { // Caching. std::unique_ptr<FileSystemStatCache> StatCache; - bool getStatValue(StringRef Path, FileData &Data, bool isFile, + bool getStatValue(StringRef Path, llvm::vfs::Status &Status, bool isFile, std::unique_ptr<llvm::vfs::File> *F); /// Add all ancestors of the given path (pointing to either a file @@ -181,6 +175,10 @@ class FileManager : public RefCountedBase<FileManager> { void fillRealPathName(FileEntry *UFE, llvm::StringRef FileName); public: + /// Construct a file manager, optionally with a custom VFS. + /// + /// \param FS if non-null, the VFS to use. Otherwise uses + /// llvm::vfs::getRealFileSystem(). FileManager(const FileSystemOptions &FileSystemOpts, IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS = nullptr); ~FileManager(); @@ -223,9 +221,7 @@ public: FileSystemOptions &getFileSystemOpts() { return FileSystemOpts; } const FileSystemOptions &getFileSystemOpts() const { return FileSystemOpts; } - IntrusiveRefCntPtr<llvm::vfs::FileSystem> getVirtualFileSystem() const { - return FS; - } + llvm::vfs::FileSystem &getVirtualFileSystem() const { return *FS; } /// Retrieve a file entry for a "virtual" file that acts as /// if there were a file with the given name on disk. |