LLVM 19.0.0git
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
llvm::vfs::OverlayFileSystem Class Reference

A file system that allows overlaying one AbstractFileSystem on top of another. More...

#include "llvm/Support/VirtualFileSystem.h"

Inheritance diagram for llvm::vfs::OverlayFileSystem:
Inheritance graph
[legend]

Public Types

using iterator = FileSystemList::reverse_iterator
 
using const_iterator = FileSystemList::const_reverse_iterator
 
using reverse_iterator = FileSystemList::iterator
 
using const_reverse_iterator = FileSystemList::const_iterator
 
using range = iterator_range< iterator >
 
using const_range = iterator_range< const_iterator >
 

Public Member Functions

 OverlayFileSystem (IntrusiveRefCntPtr< FileSystem > Base)
 
void pushOverlay (IntrusiveRefCntPtr< FileSystem > FS)
 Pushes a file system on top of the stack.
 
llvm::ErrorOr< Statusstatus (const Twine &Path) override
 
llvm::ErrorOr< std::unique_ptr< File > > openFileForRead (const Twine &Path) override
 
directory_iterator dir_begin (const Twine &Dir, std::error_code &EC) override
 
llvm::ErrorOr< std::string > getCurrentWorkingDirectory () const override
 
std::error_code setCurrentWorkingDirectory (const Twine &Path) override
 
std::error_code isLocal (const Twine &Path, bool &Result) override
 
std::error_code getRealPath (const Twine &Path, SmallVectorImpl< char > &Output) const override
 
iterator overlays_begin ()
 Get an iterator pointing to the most recently added file system.
 
const_iterator overlays_begin () const
 
iterator overlays_end ()
 Get an iterator pointing one-past the least recently added file system.
 
const_iterator overlays_end () const
 
reverse_iterator overlays_rbegin ()
 Get an iterator pointing to the least recently added file system.
 
const_reverse_iterator overlays_rbegin () const
 
reverse_iterator overlays_rend ()
 Get an iterator pointing one-past the most recently added file system.
 
const_reverse_iterator overlays_rend () const
 
range overlays_range ()
 
const_range overlays_range () const
 
- Public Member Functions inherited from llvm::RTTIExtends< OverlayFileSystem, FileSystem >
const void * dynamicClassID () const override
 
bool isA (const void *const ClassID) const override
 

Static Public Attributes

static const char ID = 0
 

Protected Member Functions

void printImpl (raw_ostream &OS, PrintType Type, unsigned IndentLevel) const override
 
void visitChildFileSystems (VisitCallbackTy Callback) override
 

Additional Inherited Members

- Static Public Member Functions inherited from llvm::RTTIExtends< OverlayFileSystem, FileSystem >
static const void * classID ()
 
static bool classof (const RTTIRoot *R)
 

Detailed Description

A file system that allows overlaying one AbstractFileSystem on top of another.

Consists of a stack of >=1 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 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).

Definition at line 374 of file VirtualFileSystem.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 399 of file VirtualFileSystem.h.

◆ const_range

Definition at line 403 of file VirtualFileSystem.h.

◆ const_reverse_iterator

Definition at line 401 of file VirtualFileSystem.h.

◆ iterator

Definition at line 398 of file VirtualFileSystem.h.

◆ range

Definition at line 402 of file VirtualFileSystem.h.

◆ reverse_iterator

Definition at line 400 of file VirtualFileSystem.h.

Constructor & Destructor Documentation

◆ OverlayFileSystem()

OverlayFileSystem::OverlayFileSystem ( IntrusiveRefCntPtr< FileSystem Base)

Member Function Documentation

◆ dir_begin()

directory_iterator OverlayFileSystem::dir_begin ( const Twine Dir,
std::error_code &  EC 
)
override

Definition at line 586 of file VirtualFileSystem.cpp.

References llvm::Twine::str().

◆ getCurrentWorkingDirectory()

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

◆ getRealPath()

std::error_code OverlayFileSystem::getRealPath ( const Twine Path,
SmallVectorImpl< char > &  Output 
) const
override

Definition at line 475 of file VirtualFileSystem.cpp.

References llvm::no_such_file_or_directory.

◆ isLocal()

std::error_code OverlayFileSystem::isLocal ( const Twine Path,
bool Result 
)
override

Definition at line 467 of file VirtualFileSystem.cpp.

References llvm::no_such_file_or_directory.

◆ openFileForRead()

ErrorOr< std::unique_ptr< File > > OverlayFileSystem::openFileForRead ( const Twine Path)
override

◆ overlays_begin() [1/2]

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

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

Definition at line 406 of file VirtualFileSystem.h.

References llvm::SmallVectorTemplateCommon< T, typename >::rbegin().

Referenced by openFileForRead(), and status().

◆ overlays_begin() [2/2]

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

◆ overlays_end() [1/2]

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

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

Definition at line 410 of file VirtualFileSystem.h.

References llvm::SmallVectorTemplateCommon< T, typename >::rend().

Referenced by openFileForRead(), and status().

◆ overlays_end() [2/2]

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

◆ overlays_range() [1/2]

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

Definition at line 421 of file VirtualFileSystem.h.

References llvm::reverse().

Referenced by printImpl(), and visitChildFileSystems().

◆ overlays_range() [2/2]

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

Definition at line 422 of file VirtualFileSystem.h.

References llvm::reverse().

◆ overlays_rbegin() [1/2]

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

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

Definition at line 414 of file VirtualFileSystem.h.

References llvm::SmallVectorTemplateCommon< T, typename >::begin().

◆ overlays_rbegin() [2/2]

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

◆ overlays_rend() [1/2]

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

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

Definition at line 418 of file VirtualFileSystem.h.

References llvm::SmallVectorTemplateCommon< T, typename >::end().

◆ overlays_rend() [2/2]

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

◆ printImpl()

void OverlayFileSystem::printImpl ( raw_ostream OS,
PrintType  Type,
unsigned  IndentLevel 
) const
overrideprotected

Definition at line 490 of file VirtualFileSystem.cpp.

References OS, and overlays_range().

◆ pushOverlay()

void OverlayFileSystem::pushOverlay ( IntrusiveRefCntPtr< FileSystem FS)

Pushes a file system on top of the stack.

Definition at line 425 of file VirtualFileSystem.cpp.

References llvm::get(), getCurrentWorkingDirectory(), and llvm::SmallVectorTemplateBase< T, bool >::push_back().

◆ setCurrentWorkingDirectory()

std::error_code OverlayFileSystem::setCurrentWorkingDirectory ( const Twine Path)
override

Definition at line 460 of file VirtualFileSystem.cpp.

◆ status()

ErrorOr< Status > OverlayFileSystem::status ( const Twine Path)
override

◆ visitChildFileSystems()

void OverlayFileSystem::visitChildFileSystems ( VisitCallbackTy  Callback)
overrideprotected

Definition at line 483 of file VirtualFileSystem.cpp.

References overlays_range().

Member Data Documentation

◆ ID

const char OverlayFileSystem::ID = 0
static

Definition at line 382 of file VirtualFileSystem.h.


The documentation for this class was generated from the following files: