LLVM 18.0.0git
Public Member Functions | Protected Member Functions | List of all members
llvm::vfs::ProxyFileSystem Class Reference

By default, this delegates all calls to the underlying file system. More...

#include "llvm/Support/VirtualFileSystem.h"

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

Public Member Functions

 ProxyFileSystem (IntrusiveRefCntPtr< FileSystem > FS)
 
llvm::ErrorOr< Statusstatus (const Twine &Path) override
 Get the status of the entry at Path, if one exists.
 
llvm::ErrorOr< std::unique_ptr< File > > openFileForRead (const Twine &Path) override
 Get a File object for the file at Path, if one exists.
 
directory_iterator dir_begin (const Twine &Dir, std::error_code &EC) override
 Get a directory_iterator for Dir.
 
llvm::ErrorOr< std::string > getCurrentWorkingDirectory () const override
 Get the working directory of this file system.
 
std::error_code setCurrentWorkingDirectory (const Twine &Path) override
 Set the working directory.
 
std::error_code getRealPath (const Twine &Path, SmallVectorImpl< char > &Output) const override
 Gets real path of Path e.g.
 
std::error_code isLocal (const Twine &Path, bool &Result) override
 Is the file mounted on a local filesystem?
 
- Public Member Functions inherited from llvm::vfs::FileSystem
virtual ~FileSystem ()
 
virtual llvm::ErrorOr< Statusstatus (const Twine &Path)=0
 Get the status of the entry at Path, if one exists.
 
virtual llvm::ErrorOr< std::unique_ptr< File > > openFileForRead (const Twine &Path)=0
 Get a File object for the file at Path, if one exists.
 
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.
 
virtual directory_iterator dir_begin (const Twine &Dir, std::error_code &EC)=0
 Get a directory_iterator for Dir.
 
virtual std::error_code setCurrentWorkingDirectory (const Twine &Path)=0
 Set the working directory.
 
virtual llvm::ErrorOr< std::string > getCurrentWorkingDirectory () const =0
 Get the working directory of this file system.
 
virtual std::error_code getRealPath (const Twine &Path, SmallVectorImpl< char > &Output) const
 Gets real path of Path e.g.
 
bool exists (const Twine &Path)
 Check whether a file exists. Provided for convenience.
 
virtual std::error_code isLocal (const Twine &Path, bool &Result)
 Is the file mounted on a local filesystem?
 
virtual std::error_code makeAbsolute (SmallVectorImpl< char > &Path) const
 Make Path an absolute path.
 
void print (raw_ostream &OS, PrintType Type=PrintType::Contents, unsigned IndentLevel=0) const
 
LLVM_DUMP_METHOD void dump () const
 
- Public Member Functions inherited from llvm::ThreadSafeRefCountedBase< FileSystem >
unsigned UseCount () const
 
void Retain () const
 
void Release () const
 

Protected Member Functions

FileSystemgetUnderlyingFS () const
 
- Protected Member Functions inherited from llvm::vfs::FileSystem
virtual void printImpl (raw_ostream &OS, PrintType Type, unsigned IndentLevel) const
 
void printIndent (raw_ostream &OS, unsigned IndentLevel) const
 
- Protected Member Functions inherited from llvm::ThreadSafeRefCountedBase< FileSystem >
 ThreadSafeRefCountedBase ()=default
 
 ThreadSafeRefCountedBase (const ThreadSafeRefCountedBase &)
 
ThreadSafeRefCountedBaseoperator= (const ThreadSafeRefCountedBase &)=delete
 
 ~ThreadSafeRefCountedBase ()
 

Additional Inherited Members

- Public Types inherited from llvm::vfs::FileSystem
enum class  PrintType { Summary , Contents , RecursiveContents }
 

Detailed Description

By default, this delegates all calls to the underlying file system.

This is useful when derived file systems want to override some calls and still proxy other calls.

Definition at line 423 of file VirtualFileSystem.h.

Constructor & Destructor Documentation

◆ ProxyFileSystem()

llvm::vfs::ProxyFileSystem::ProxyFileSystem ( IntrusiveRefCntPtr< FileSystem FS)
inlineexplicit

Definition at line 425 of file VirtualFileSystem.h.

Member Function Documentation

◆ dir_begin()

directory_iterator llvm::vfs::ProxyFileSystem::dir_begin ( const Twine Dir,
std::error_code &  EC 
)
inlineoverridevirtual

Get a directory_iterator for Dir.

Note
The 'end' iterator is directory_iterator().

Implements llvm::vfs::FileSystem.

Definition at line 435 of file VirtualFileSystem.h.

◆ getCurrentWorkingDirectory()

llvm::ErrorOr< std::string > llvm::vfs::ProxyFileSystem::getCurrentWorkingDirectory ( ) const
inlineoverridevirtual

Get the working directory of this file system.

Implements llvm::vfs::FileSystem.

Definition at line 438 of file VirtualFileSystem.h.

◆ getRealPath()

std::error_code llvm::vfs::ProxyFileSystem::getRealPath ( const Twine Path,
SmallVectorImpl< char > &  Output 
) const
inlineoverridevirtual

Gets real path of 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.

Reimplemented from llvm::vfs::FileSystem.

Definition at line 444 of file VirtualFileSystem.h.

◆ getUnderlyingFS()

FileSystem & llvm::vfs::ProxyFileSystem::getUnderlyingFS ( ) const
inlineprotected

Definition at line 453 of file VirtualFileSystem.h.

◆ isLocal()

std::error_code llvm::vfs::ProxyFileSystem::isLocal ( const Twine Path,
bool Result 
)
inlineoverridevirtual

Is the file mounted on a local filesystem?

Reimplemented from llvm::vfs::FileSystem.

Definition at line 448 of file VirtualFileSystem.h.

◆ openFileForRead()

llvm::ErrorOr< std::unique_ptr< File > > llvm::vfs::ProxyFileSystem::openFileForRead ( const Twine Path)
inlineoverridevirtual

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

Implements llvm::vfs::FileSystem.

Definition at line 432 of file VirtualFileSystem.h.

◆ setCurrentWorkingDirectory()

std::error_code llvm::vfs::ProxyFileSystem::setCurrentWorkingDirectory ( const Twine Path)
inlineoverridevirtual

Set the working directory.

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

Implements llvm::vfs::FileSystem.

Definition at line 441 of file VirtualFileSystem.h.

◆ status()

llvm::ErrorOr< Status > llvm::vfs::ProxyFileSystem::status ( const Twine Path)
inlineoverridevirtual

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

Implements llvm::vfs::FileSystem.

Definition at line 428 of file VirtualFileSystem.h.


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