clang  6.0.0svn
Public Types | Public Member Functions | List of all members
clang::vfs::OverlayFileSystem Class Reference

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

#include "clang/Basic/VirtualFileSystem.h"

Inheritance diagram for clang::vfs::OverlayFileSystem:
Inheritance graph
[legend]
Collaboration diagram for clang::vfs::OverlayFileSystem:
Collaboration graph
[legend]

Public Types

typedef FileSystemList::reverse_iterator iterator
 

Public Member Functions

 OverlayFileSystem (IntrusiveRefCntPtr< FileSystem > Base)
 
void pushOverlay (IntrusiveRefCntPtr< FileSystem > FS)
 Pushes a file system on top of the stack. More...
 
llvm::ErrorOr< Statusstatus (const Twine &Path) override
 Get the status of the entry at Path, if one exists. More...
 
llvm::ErrorOr< std::unique_ptr< File > > openFileForRead (const Twine &Path) override
 Get a File object for the file at Path, if one exists. More...
 
directory_iterator dir_begin (const Twine &Dir, std::error_code &EC) override
 Get a directory_iterator for Dir. More...
 
llvm::ErrorOr< std::string > getCurrentWorkingDirectory () const override
 Get the working directory of this file system. More...
 
std::error_code setCurrentWorkingDirectory (const Twine &Path) override
 Set the working directory. More...
 
iterator overlays_begin ()
 Get an iterator pointing to the most recently added file system. More...
 
iterator overlays_end ()
 Get an iterator pointing one-past the least recently added file system. More...
 
- Public Member Functions inherited from clang::vfs::FileSystem
virtual ~FileSystem ()
 
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...
 
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...
 

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 278 of file VirtualFileSystem.h.

Member Typedef Documentation

◆ iterator

typedef FileSystemList::reverse_iterator clang::vfs::OverlayFileSystem::iterator

Definition at line 296 of file VirtualFileSystem.h.

Constructor & Destructor Documentation

◆ OverlayFileSystem()

OverlayFileSystem::OverlayFileSystem ( IntrusiveRefCntPtr< FileSystem Base)

Definition at line 277 of file VirtualFileSystem.cpp.

Member Function Documentation

◆ dir_begin()

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

Get a directory_iterator for Dir.

Note
The 'end' iterator is directory_iterator().

Implements clang::vfs::FileSystem.

Definition at line 384 of file VirtualFileSystem.cpp.

◆ getCurrentWorkingDirectory()

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

Get the working directory of this file system.

Implements clang::vfs::FileSystem.

Definition at line 310 of file VirtualFileSystem.cpp.

◆ openFileForRead()

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

Get a File object for the file at Path, if one exists.

Implements clang::vfs::FileSystem.

Definition at line 299 of file VirtualFileSystem.cpp.

◆ overlays_begin()

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

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

Definition at line 299 of file VirtualFileSystem.h.

◆ overlays_end()

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

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

Definition at line 303 of file VirtualFileSystem.h.

Referenced by clang::vfs::detail::DirIterImpl::~DirIterImpl().

◆ pushOverlay()

void OverlayFileSystem::pushOverlay ( IntrusiveRefCntPtr< FileSystem FS)

Pushes a file system on top of the stack.

Definition at line 281 of file VirtualFileSystem.cpp.

◆ setCurrentWorkingDirectory()

std::error_code OverlayFileSystem::setCurrentWorkingDirectory ( const Twine &  Path)
overridevirtual

Set the working directory.

This will affect all following operations on this file system and may propagate down for nested file systems.

Implements clang::vfs::FileSystem.

Definition at line 315 of file VirtualFileSystem.cpp.

◆ status()

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

Get the status of the entry at Path, if one exists.

Implements clang::vfs::FileSystem.

Definition at line 288 of file VirtualFileSystem.cpp.


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