class OverlayFileSystem

Declaration

class OverlayFileSystem : public FileSystem { /* full declaration omitted */ };

Description

A file system that allows overlaying one \p AbstractFileSystem on top of another. Consists of a stack of >=1 \p FileSystem objects, which are treated as being one merged file system. When there is a directory that exists in more than one file system, the \p OverlayFileSystem contains a directory containing the union of their contents. The attributes (permissions, etc.) of the top-most (most recently added) directory are used. When there is a file that exists in more than one file system, the file in the top-most file system overrides the other(s).

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:367

Inherits from: FileSystem

Member Variables

private llvm::vfs::OverlayFileSystem::FileSystemList FSList
The stack of file systems, implemented as a list in order of their addition.

Method Overview

  • public OverlayFileSystem(IntrusiveRefCntPtr<llvm::vfs::FileSystem> Base)
  • public llvm::vfs::directory_iterator dir_begin(const llvm::Twine & Dir, std::error_code & EC)
  • public llvm::ErrorOr<std::string> getCurrentWorkingDirectory() 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 llvm::ErrorOr<std::unique_ptr<File>> openFileForRead(const llvm::Twine & Path)
  • public llvm::vfs::OverlayFileSystem::iterator overlays_begin()
  • public llvm::vfs::OverlayFileSystem::const_iterator overlays_begin() const
  • public llvm::vfs::OverlayFileSystem::iterator overlays_end()
  • public llvm::vfs::OverlayFileSystem::const_iterator overlays_end() const
  • public llvm::vfs::OverlayFileSystem::const_range overlays_range() const
  • public llvm::vfs::OverlayFileSystem::range overlays_range()
  • public llvm::vfs::OverlayFileSystem::reverse_iterator overlays_rbegin()
  • public llvm::vfs::OverlayFileSystem::const_reverse_iterator overlays_rbegin() const
  • public llvm::vfs::OverlayFileSystem::reverse_iterator overlays_rend()
  • public llvm::vfs::OverlayFileSystem::const_reverse_iterator overlays_rend() const
  • protected void printImpl(llvm::raw_ostream & OS, llvm::vfs::FileSystem::PrintType Type, unsigned int IndentLevel) const
  • public void pushOverlay(IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS)
  • public std::error_code setCurrentWorkingDirectory(const llvm::Twine & Path)
  • public llvm::ErrorOr<Status> status(const llvm::Twine & Path)

Inherited from FileSystem:

Methods

OverlayFileSystem(
    IntrusiveRefCntPtr<llvm::vfs::FileSystem>
        Base)

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:375

Parameters

IntrusiveRefCntPtr<llvm::vfs::FileSystem> Base

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:383

Parameters

const llvm::Twine& Dir
std::error_code& EC

llvm::ErrorOr<std::string>
getCurrentWorkingDirectory() const

Description

Get the working directory of this file system.

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:384

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:387

Parameters

const llvm::Twine& Path
SmallVectorImpl<char>& Output

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:386

Parameters

const llvm::Twine& Path
bool& Result

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:382

Parameters

const llvm::Twine& Path

llvm::vfs::OverlayFileSystem::iterator
overlays_begin()

Description

Get an iterator pointing to the most recently added file system.

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:398

llvm::vfs::OverlayFileSystem::const_iterator
overlays_begin() const

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:399

llvm::vfs::OverlayFileSystem::iterator
overlays_end()

Description

Get an iterator pointing one-past the least recently added file system.

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:402

llvm::vfs::OverlayFileSystem::const_iterator
overlays_end() const

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:403

llvm::vfs::OverlayFileSystem::const_range
overlays_range() const

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:414

llvm::vfs::OverlayFileSystem::range
overlays_range()

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:413

llvm::vfs::OverlayFileSystem::reverse_iterator
overlays_rbegin()

Description

Get an iterator pointing to the least recently added file system.

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:406

llvm::vfs::OverlayFileSystem::
    const_reverse_iterator
    overlays_rbegin() const

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:407

llvm::vfs::OverlayFileSystem::reverse_iterator
overlays_rend()

Description

Get an iterator pointing one-past the most recently added file system.

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:410

llvm::vfs::OverlayFileSystem::
    const_reverse_iterator
    overlays_rend() const

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:411

void printImpl(
    llvm::raw_ostream& OS,
    llvm::vfs::FileSystem::PrintType Type,
    unsigned int IndentLevel) const

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:417

Parameters

llvm::raw_ostream& OS
llvm::vfs::FileSystem::PrintType Type
unsigned int IndentLevel

void pushOverlay(
    IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS)

Description

Pushes a file system on top of the stack.

Declared at: llvm/include/llvm/Support/VirtualFileSystem.h:378

Parameters

IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS

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:385

Parameters

const llvm::Twine& Path

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:380

Parameters

const llvm::Twine& Path