diff options
Diffstat (limited to 'clang/include')
| -rw-r--r-- | clang/include/clang/Basic/FileManager.h | 4 | ||||
| -rw-r--r-- | clang/include/clang/Frontend/CompilerInstance.h | 20 |
2 files changed, 7 insertions, 17 deletions
diff --git a/clang/include/clang/Basic/FileManager.h b/clang/include/clang/Basic/FileManager.h index 6547f8a4c49..b8348269124 100644 --- a/clang/include/clang/Basic/FileManager.h +++ b/clang/include/clang/Basic/FileManager.h @@ -175,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(); diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h index 2fc61574e30..f63ff48f69a 100644 --- a/clang/include/clang/Frontend/CompilerInstance.h +++ b/clang/include/clang/Frontend/CompilerInstance.h @@ -82,9 +82,6 @@ class CompilerInstance : public ModuleLoader { /// Auxiliary Target info. IntrusiveRefCntPtr<TargetInfo> AuxTarget; - /// The virtual file system. - IntrusiveRefCntPtr<llvm::vfs::FileSystem> VirtualFileSystem; - /// The file manager. IntrusiveRefCntPtr<FileManager> FileMgr; @@ -382,20 +379,8 @@ public: /// @name Virtual File System /// { - bool hasVirtualFileSystem() const { return VirtualFileSystem != nullptr; } - llvm::vfs::FileSystem &getVirtualFileSystem() const { - assert(hasVirtualFileSystem() && - "Compiler instance has no virtual file system"); - return *VirtualFileSystem; - } - - /// Replace the current virtual file system. - /// - /// \note Most clients should use setFileManager, which will implicitly reset - /// the virtual file system to the one contained in the file manager. - void setVirtualFileSystem(IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS) { - VirtualFileSystem = std::move(FS); + return *getFileManager().getVirtualFileSystem(); } /// } @@ -645,7 +630,8 @@ public: /// Create the file manager and replace any existing one with it. /// /// \return The new file manager on success, or null on failure. - FileManager *createFileManager(); + FileManager * + createFileManager(IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = nullptr); /// Create the source manager and replace any existing one with it. void createSourceManager(FileManager &FileMgr); |

