clang
3.9.0
|
The virtual file system interface. More...
#include <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... | |
bool | exists (const Twine &Path) |
Check whether a file exists. Provided for convenience. More... | |
std::error_code | makeAbsolute (SmallVectorImpl< char > &Path) const |
Make Path an absolute path. More... | |
The virtual file system interface.
Definition at line 196 of file VirtualFileSystem.h.
|
virtual |
Definition at line 92 of file VirtualFileSystem.cpp.
|
pure virtual |
Get a directory_iterator for Dir
.
Implemented in clang::vfs::InMemoryFileSystem, and clang::vfs::OverlayFileSystem.
Referenced by clang::HeaderSearch::collectAllModules().
bool FileSystem::exists | ( | const Twine & | Path | ) |
Check whether a file exists. Provided for convenience.
Definition at line 115 of file VirtualFileSystem.cpp.
References clang::vfs::Status::exists(), and status().
Referenced by clang::driver::toolchains::Linux::AddClangCXXStdlibIncludeArgs(), clang::driver::toolchains::Linux::AddClangSystemIncludeArgs(), clang::driver::toolchains::DarwinClang::AddCXXStdlibLibArgs(), clang::driver::toolchains::Generic_GCC::addLibStdCXXIncludePaths(), addPathIfExists(), clang::driver::toolchains::Linux::computeSysRoot(), DetectDistro(), clang::driver::toolchains::FreeBSD::FreeBSD(), clang::driver::toolchains::HexagonToolChain::getHexagonTargetDir(), getMultiarchTriple(), and clang::driver::toolchains::HexagonToolChain::HexagonToolChain().
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 95 of file VirtualFileSystem.cpp.
References openFileForRead().
Referenced by clang::format::getStyle().
|
pure virtual |
Get the working directory of this file system.
Implemented in clang::vfs::InMemoryFileSystem, and clang::vfs::OverlayFileSystem.
Referenced by makeAbsolute().
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 104 of file VirtualFileSystem.cpp.
References getCurrentWorkingDirectory().
Referenced by clang::vfs::InMemoryFileSystem::addFile(), clang::vfs::lookupInMemoryNode(), and clang::vfs::InMemoryFileSystem::setCurrentWorkingDirectory().
|
pure virtual |
Get a File
object for the file at Path
, if one exists.
Implemented in clang::vfs::InMemoryFileSystem, and clang::vfs::OverlayFileSystem.
Referenced by clang::FileSystemStatCache::get(), and getBufferForFile().
|
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 clang::vfs::InMemoryFileSystem, and clang::vfs::OverlayFileSystem.
|
pure virtual |
Get the status of the entry at Path
, if one exists.
Implemented in clang::vfs::InMemoryFileSystem, and clang::vfs::OverlayFileSystem.
Referenced by exists(), clang::FileSystemStatCache::get(), and clang::format::getStyle().