class RedirectingFileSystem
Declaration
class RedirectingFileSystem : public FileSystem { /* full declaration omitted */ };
Description
A virtual file system parsed from a YAML file. Currently, this class allows creating virtual directories and mapping virtual file paths to existing external files, available in \c ExternalFS. The basic structure of the parsed file is: All configuration options are optional. 'case-sensitive': <boolean , default=(true for Posix, false for Windows)> 'use-external-names': <boolean , default=true> 'overlay-relative': <boolean , default=false> 'fallthrough': <boolean , default=true> Virtual directories are represented as The default attributes for virtual directories are: Re-mapped files are represented as and inherit their attributes from the external contents. In both cases, the 'name' field may contain multiple path components (e.g. /path/to/file). However, any directory that contains more than one child must be uniquely represented by a directory entry.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:573
Inherits from: FileSystem
Method Overview
- public static llvm::vfs::RedirectingFileSystem * create(std::unique_ptr<MemoryBuffer> Buffer, SourceMgr::DiagHandlerTy DiagHandler, llvm::StringRef YAMLFilePath, void * DiagContext, IntrusiveRefCntPtr<llvm::vfs::FileSystem> ExternalFS)
- public llvm::vfs::directory_iterator dir_begin(const llvm::Twine & Dir, std::error_code & EC)
- public void dump(llvm::raw_ostream & OS) const
- public void dump() const
- public void dumpEntry(llvm::raw_ostream & OS, llvm::vfs::RedirectingFileSystem::Entry * E, int NumSpaces = 0) const
- public llvm::ErrorOr<std::string> getCurrentWorkingDirectory() const
- public llvm::StringRef getExternalContentsPrefixDir() const
- public std::error_code getRealPath(const llvm::Twine & Path, SmallVectorImpl<char> & Output) const
- public std::error_code isLocal(const llvm::Twine & Path, bool & Result)
- public ErrorOr<llvm::vfs::RedirectingFileSystem::Entry *> lookupPath(const llvm::Twine & Path) const
- public std::error_code makeAbsolute(SmallVectorImpl<char> & Path) const
- public ErrorOr<std::unique_ptr<File>> openFileForRead(const llvm::Twine & Path)
- public std::error_code setCurrentWorkingDirectory(const llvm::Twine & Path)
- public void setExternalContentsPrefixDir(llvm::StringRef PrefixDir)
- public ErrorOr<llvm::vfs::Status> status(const llvm::Twine & Path)
Inherited from FileSystem:
- public dir_begin
- public exists
- public getBufferForFile
- public getCurrentWorkingDirectory
- public getRealPath
- public isLocal
- public makeAbsolute
- public openFileForRead
- public setCurrentWorkingDirectory
- public status
Methods
¶static llvm::vfs::RedirectingFileSystem* create(
std::unique_ptr<MemoryBuffer> Buffer,
SourceMgr::DiagHandlerTy DiagHandler,
llvm::StringRef YAMLFilePath,
void* DiagContext,
IntrusiveRefCntPtr<llvm::vfs::FileSystem>
ExternalFS)
static llvm::vfs::RedirectingFileSystem* create(
std::unique_ptr<MemoryBuffer> Buffer,
SourceMgr::DiagHandlerTy DiagHandler,
llvm::StringRef YAMLFilePath,
void* DiagContext,
IntrusiveRefCntPtr<llvm::vfs::FileSystem>
ExternalFS)
Description
Parses \p Buffer, which is expected to be in YAML format and returns a virtual file system representing its contents.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:736
Parameters
- std::unique_ptr<MemoryBuffer> Buffer
- SourceMgr::DiagHandlerTy DiagHandler
- llvm::StringRef YAMLFilePath
- void* DiagContext
- IntrusiveRefCntPtr<llvm::vfs::FileSystem> ExternalFS
¶llvm::vfs::directory_iterator dir_begin(
const llvm::Twine& Dir,
std::error_code& EC)
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:754
Parameters
- const llvm::Twine& Dir
- std::error_code& EC
¶void dump(llvm::raw_ostream& OS) const
void dump(llvm::raw_ostream& OS) const
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:760
Parameters
¶void dump() const
void dump() const
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:763
¶void dumpEntry(
llvm::raw_ostream& OS,
llvm::vfs::RedirectingFileSystem::Entry* E,
int NumSpaces = 0) const
void dumpEntry(
llvm::raw_ostream& OS,
llvm::vfs::RedirectingFileSystem::Entry* E,
int NumSpaces = 0) const
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:761
Parameters
- llvm::raw_ostream& OS
- llvm::vfs::RedirectingFileSystem::Entry* E
- int NumSpaces = 0
¶llvm::ErrorOr<std::string>
getCurrentWorkingDirectory() const
llvm::ErrorOr<std::string>
getCurrentWorkingDirectory() const
Description
Get the working directory of this file system.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:746
¶llvm::StringRef getExternalContentsPrefixDir()
const
llvm::StringRef getExternalContentsPrefixDir()
const
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:758
¶std::error_code getRealPath(
const llvm::Twine& Path,
SmallVectorImpl<char>& Output) const
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:743
Parameters
- const llvm::Twine& Path
- SmallVectorImpl<char>& Output
¶std::error_code isLocal(const llvm::Twine& Path,
bool& Result)
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:750
Parameters
- const llvm::Twine& Path
- bool& Result
¶ErrorOr<llvm::vfs::RedirectingFileSystem::Entry*>
lookupPath(const llvm::Twine& Path) const
ErrorOr<llvm::vfs::RedirectingFileSystem::Entry*>
lookupPath(const llvm::Twine& Path) const
Description
Looks up \p Path in \c Roots.
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:731
Parameters
- const llvm::Twine& Path
¶std::error_code makeAbsolute(
SmallVectorImpl<char>& Path) const
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:752
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.
¶ErrorOr<std::unique_ptr<File>> openFileForRead(
const llvm::Twine& Path)
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:741
Parameters
- const llvm::Twine& Path
¶std::error_code setCurrentWorkingDirectory(
const llvm::Twine& Path)
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:748
Parameters
- const llvm::Twine& Path
¶void setExternalContentsPrefixDir(
llvm::StringRef PrefixDir)
void setExternalContentsPrefixDir(
llvm::StringRef PrefixDir)
Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:756
Parameters
- llvm::StringRef PrefixDir
¶ErrorOr<llvm::vfs::Status> status(
const llvm::Twine& Path)
ErrorOr<llvm::vfs::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:740
Parameters
- const llvm::Twine& Path