class FileSystem
Declaration
class FileSystem : public ThreadSafeRefCountedBase { /* full declaration omitted */ };
Description
The virtual file system interface.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:244
Inherits from: ThreadSafeRefCountedBase
Method Overview
- public virtual llvm::vfs::directory_iterator dir_begin(const llvm::Twine & Dir, std::error_code & EC)
- public bool exists(const llvm::Twine & Path)
- public llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> getBufferForFile(const llvm::Twine & Name, int64_t FileSize = -1, bool RequiresNullTerminator = true, bool IsVolatile = false)
- public virtual llvm::ErrorOr<std::string> getCurrentWorkingDirectory() const
- public virtual std::error_code getRealPath(const llvm::Twine & Path, SmallVectorImpl<char> & Output) const
- public virtual std::error_code isLocal(const llvm::Twine & Path, bool & Result)
- public virtual std::error_code makeAbsolute(SmallVectorImpl<char> & Path) const
- public virtual llvm::ErrorOr<std::unique_ptr<File>> openFileForRead(const llvm::Twine & Path)
- public virtual std::error_code setCurrentWorkingDirectory(const llvm::Twine & Path)
- public virtual llvm::ErrorOr<Status> status(const llvm::Twine & Path)
- public virtual ~FileSystem()
Methods
¶virtual llvm::vfs::directory_iterator dir_begin(
const llvm::Twine& Dir,
std::error_code& EC)
virtual llvm::vfs::directory_iterator dir_begin(
const llvm::Twine& Dir,
std::error_code& EC)
Description
Get a directory_iterator for \p Dir.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:263
Parameters
- const llvm::Twine& Dir
- std::error_code& EC
¶bool exists(const llvm::Twine& Path)
bool exists(const llvm::Twine& Path)
Description
Check whether a file exists. Provided for convenience.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:280
Parameters
- const llvm::Twine& Path
¶llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
getBufferForFile(
const llvm::Twine& Name,
int64_t FileSize = -1,
bool RequiresNullTerminator = true,
bool IsVolatile = false)
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
getBufferForFile(
const llvm::Twine& Name,
int64_t FileSize = -1,
bool RequiresNullTerminator = true,
bool IsVolatile = false)
Description
This is a convenience method that opens a file, gets its content and then closes the file.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:258
Parameters
- const llvm::Twine& Name
- int64_t FileSize = -1
- bool RequiresNullTerminator = true
- bool IsVolatile = false
¶virtual llvm::ErrorOr<std::string>
getCurrentWorkingDirectory() const
virtual llvm::ErrorOr<std::string>
getCurrentWorkingDirectory() const
Description
Get the working directory of this file system.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:271
¶virtual std::error_code getRealPath(
const llvm::Twine& Path,
SmallVectorImpl<char>& Output) const
virtual std::error_code getRealPath(
const llvm::Twine& Path,
SmallVectorImpl<char>& Output) const
Description
Gets real path of \p Path e.g. collapse all . and .. patterns, resolve symlinks. For real file system, this uses `llvm::sys::fs::real_path`. This returns errc::operation_not_permitted if not implemented by subclass.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:276
Parameters
- const llvm::Twine& Path
- SmallVectorImpl<char>& Output
¶virtual std::error_code isLocal(
const llvm::Twine& Path,
bool& Result)
virtual std::error_code isLocal(
const llvm::Twine& Path,
bool& Result)
Description
Is the file mounted on a local filesystem?
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:283
Parameters
- const llvm::Twine& Path
- bool& Result
¶virtual std::error_code makeAbsolute(
SmallVectorImpl<char>& Path) const
virtual std::error_code makeAbsolute(
SmallVectorImpl<char>& Path) const
Description
Make \a Path an absolute path. Makes \a Path absolute using the current directory if it is not already. An empty \a Path will result in the current directory. /absolute/path => /absolute/path relative/../path => <current -directory>/relative/../path
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:296
Parameters
- SmallVectorImpl<char>& Path
- A path that is modified to be an absolute path.
Returns
success if \a path has been made absolute, otherwise a platform-specific error_code.
¶virtual llvm::ErrorOr<std::unique_ptr<File>>
openFileForRead(const llvm::Twine& Path)
virtual llvm::ErrorOr<std::unique_ptr<File>>
openFileForRead(const llvm::Twine& Path)
Description
Get a \p File object for the file at \p Path, if one exists.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:253
Parameters
- const llvm::Twine& Path
¶virtual std::error_code
setCurrentWorkingDirectory(
const llvm::Twine& Path)
virtual std::error_code
setCurrentWorkingDirectory(
const llvm::Twine& Path)
Description
Set the working directory. This will affect all following operations on this file system and may propagate down for nested file systems.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:268
Parameters
- const llvm::Twine& Path
¶virtual llvm::ErrorOr<Status> status(
const llvm::Twine& Path)
virtual llvm::ErrorOr<Status> status(
const llvm::Twine& Path)
Description
Get the status of the entry at \p Path, if one exists.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:249
Parameters
- const llvm::Twine& Path
¶virtual ~FileSystem()
virtual ~FileSystem()
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:246