LLVM
8.0.1
|
The virtual file system interface. More...
#include "llvm/Support/VirtualFileSystem.h"
Public Member Functions | |
virtual | ~FileSystem () |
virtual llvm::ErrorOr< Status > | status (const Twine &Path)=0 |
Get the status of the entry at Path , if one exists. More... | |
virtual llvm::ErrorOr< std::unique_ptr< File > > | openFileForRead (const Twine &Path)=0 |
Get a File object for the file at Path , if one exists. More... | |
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > | getBufferForFile (const Twine &Name, int64_t FileSize=-1, bool RequiresNullTerminator=true, bool IsVolatile=false) |
This is a convenience method that opens a file, gets its content and then closes the file. More... | |
virtual directory_iterator | dir_begin (const Twine &Dir, std::error_code &EC)=0 |
Get a directory_iterator for Dir . More... | |
virtual std::error_code | setCurrentWorkingDirectory (const Twine &Path)=0 |
Set the working directory. More... | |
virtual llvm::ErrorOr< std::string > | getCurrentWorkingDirectory () const =0 |
Get the working directory of this file system. More... | |
virtual std::error_code | getRealPath (const Twine &Path, SmallVectorImpl< char > &Output) const |
Gets real path of Path e.g. More... | |
bool | exists (const Twine &Path) |
Check whether a file exists. Provided for convenience. More... | |
virtual std::error_code | isLocal (const Twine &Path, bool &Result) |
Is the file mounted on a local filesystem? More... | |
std::error_code | makeAbsolute (SmallVectorImpl< char > &Path) const |
Make Path an absolute path. More... | |
Public Member Functions inherited from llvm::ThreadSafeRefCountedBase< FileSystem > | |
void | Retain () const |
void | Release () const |
Additional Inherited Members | |
Protected Member Functions inherited from llvm::ThreadSafeRefCountedBase< FileSystem > | |
ThreadSafeRefCountedBase () | |
The virtual file system interface.
Definition at line 245 of file VirtualFileSystem.h.
|
virtualdefault |
Referenced by llvm::vfs::Status::exists().
|
pure virtual |
Get a directory_iterator for Dir
.
Implemented in llvm::vfs::RedirectingFileSystem, llvm::vfs::InMemoryFileSystem, llvm::vfs::ProxyFileSystem, and llvm::vfs::OverlayFileSystem.
Referenced by llvm::vfs::recursive_directory_iterator::recursive_directory_iterator().
Check whether a file exists. Provided for convenience.
Definition at line 144 of file VirtualFileSystem.cpp.
References llvm::vfs::Status::exists(), and llvm::sys::fs::status().
ErrorOr< std::unique_ptr< MemoryBuffer > > FileSystem::getBufferForFile | ( | const Twine & | Name, |
int64_t | FileSize = -1 , |
||
bool | RequiresNullTerminator = true , |
||
bool | IsVolatile = false |
||
) |
This is a convenience method that opens a file, gets its content and then closes the file.
Definition at line 114 of file VirtualFileSystem.cpp.
References F(), and llvm::sys::fs::openFileForRead().
|
pure virtual |
Get the working directory of this file system.
Implemented in llvm::vfs::RedirectingFileSystem, llvm::vfs::InMemoryFileSystem, llvm::vfs::ProxyFileSystem, and llvm::vfs::OverlayFileSystem.
|
virtual |
Gets real path of 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.
Reimplemented in llvm::vfs::RedirectingFileSystem, llvm::vfs::InMemoryFileSystem, llvm::vfs::ProxyFileSystem, and llvm::vfs::OverlayFileSystem.
Definition at line 135 of file VirtualFileSystem.cpp.
References llvm::operation_not_permitted.
Is the file mounted on a local filesystem?
Reimplemented in llvm::vfs::RedirectingFileSystem, llvm::vfs::InMemoryFileSystem, llvm::vfs::ProxyFileSystem, and llvm::vfs::OverlayFileSystem.
Definition at line 140 of file VirtualFileSystem.cpp.
References llvm::operation_not_permitted.
std::error_code FileSystem::makeAbsolute | ( | SmallVectorImpl< char > & | Path | ) | const |
Make Path an absolute path.
Makes Path absolute using the current directory if it is not already. An empty Path will result in the current directory.
/absolute/path => /absolute/path relative/../path => <current-directory>/relative/../path
Path | A path that is modified to be an absolute path. |
Definition at line 123 of file VirtualFileSystem.cpp.
References llvm::sys::path::is_absolute(), and llvm::sys::fs::make_absolute().
Referenced by llvm::vfs::InMemoryFileSystem::getRealPath(), llvm::vfs::lookupInMemoryNode(), llvm::vfs::RedirectingFileSystem::lookupPath(), llvm::vfs::InMemoryFileSystem::setCurrentWorkingDirectory(), and llvm::vfs::InMemoryFileSystem::toString().
|
pure virtual |
Get a File
object for the file at Path
, if one exists.
Implemented in llvm::vfs::RedirectingFileSystem, llvm::vfs::InMemoryFileSystem, llvm::vfs::ProxyFileSystem, and llvm::vfs::OverlayFileSystem.
|
pure virtual |
Set the working directory.
This will affect all following operations on this file system and may propagate down for nested file systems.
Implemented in llvm::vfs::RedirectingFileSystem, llvm::vfs::InMemoryFileSystem, llvm::vfs::ProxyFileSystem, and llvm::vfs::OverlayFileSystem.
Referenced by llvm::vfs::OverlayFileSystem::pushOverlay().
|
pure virtual |
Get the status of the entry at Path
, if one exists.
Implemented in llvm::vfs::RedirectingFileSystem, llvm::vfs::InMemoryFileSystem, llvm::vfs::ProxyFileSystem, and llvm::vfs::OverlayFileSystem.