clang 20.0.0git
|
Implements support for file system lookup, file system caching, and directory search management. More...
#include "clang/Basic/FileManager.h"
Public Member Functions | |
FileManager (const FileSystemOptions &FileSystemOpts, IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS=nullptr) | |
Construct a file manager, optionally with a custom VFS. | |
~FileManager () | |
void | setStatCache (std::unique_ptr< FileSystemStatCache > statCache) |
Installs the provided FileSystemStatCache object within the FileManager. | |
void | clearStatCache () |
Removes the FileSystemStatCache object from the manager. | |
size_t | getNumUniqueRealFiles () const |
Returns the number of unique real file entries cached by the file manager. | |
llvm::Expected< DirectoryEntryRef > | getDirectoryRef (StringRef DirName, bool CacheFailure=true) |
Lookup, cache, and verify the specified directory (real or virtual). | |
OptionalDirectoryEntryRef | getOptionalDirectoryRef (StringRef DirName, bool CacheFailure=true) |
Get a DirectoryEntryRef if it exists, without doing anything on error. | |
LLVM_DEPRECATED("Functions returning DirectoryEntry are deprecated.", "getOptionalDirectoryRef()") llvm LLVM_DEPRECATED("Functions returning FileEntry are deprecated.", "getOptionalFileRef()") llvm llvm::Expected< FileEntryRef > | getFileRef (StringRef Filename, bool OpenFile=false, bool CacheFailure=true, bool IsText=true) |
Lookup, cache, and verify the specified directory (real or virtual). | |
llvm::Expected< FileEntryRef > | getSTDIN () |
Get the FileEntryRef for stdin, returning an error if stdin cannot be read. | |
OptionalFileEntryRef | getOptionalFileRef (StringRef Filename, bool OpenFile=false, bool CacheFailure=true) |
Get a FileEntryRef if it exists, without doing anything on error. | |
FileSystemOptions & | getFileSystemOpts () |
Returns the current file system options. | |
const FileSystemOptions & | getFileSystemOpts () const |
llvm::vfs::FileSystem & | getVirtualFileSystem () const |
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > | getVirtualFileSystemPtr () const |
void | trackVFSUsage (bool Active) |
Enable or disable tracking of VFS usage. | |
void | setVirtualFileSystem (IntrusiveRefCntPtr< llvm::vfs::FileSystem > FS) |
FileEntryRef | getVirtualFileRef (StringRef Filename, off_t Size, time_t ModificationTime) |
Retrieve a file entry for a "virtual" file that acts as if there were a file with the given name on disk. | |
LLVM_DEPRECATED ("Functions returning FileEntry are deprecated.", "getVirtualFileRef()") const FileEntry *getVirtualFile(StringRef Filename | |
OptionalFileEntryRef | getBypassFile (FileEntryRef VFE) |
Retrieve a FileEntry that bypasses VFE, which is expected to be a virtual file entry, to access the real file. | |
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > | getBufferForFile (FileEntryRef Entry, bool isVolatile=false, bool RequiresNullTerminator=true, std::optional< int64_t > MaybeLimit=std::nullopt, bool IsText=true) |
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null. | |
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > | getBufferForFile (StringRef Filename, bool isVolatile=false, bool RequiresNullTerminator=true, std::optional< int64_t > MaybeLimit=std::nullopt, bool IsText=true) const |
std::error_code | getNoncachedStatValue (StringRef Path, llvm::vfs::Status &Result) |
Get the 'stat' information for the given Path . | |