clang  6.0.0svn
Public Member Functions | List of all members
clang::vfs::FileSystem Class Referenceabstract

The virtual file system interface. More...

#include "clang/Basic/VirtualFileSystem.h"

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

Public Member Functions

virtual ~FileSystem ()
 
virtual llvm::ErrorOr< Statusstatus (const Twine &Path)=0
 Get the status of the entry at Path, if one exists. More...
 
virtual llvm::ErrorOr< std::unique_ptr< File > > openFileForRead (const Twine &Path)=0
 Get a File object for the file at Path, if one exists. More...
 
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...
 
virtual directory_iterator dir_begin (const Twine &Dir, std::error_code &EC)=0
 Get a directory_iterator for Dir. More...
 
virtual std::error_code setCurrentWorkingDirectory (const Twine &Path)=0
 Set the working directory. More...
 
virtual llvm::ErrorOr< std::string > getCurrentWorkingDirectory () const =0
 Get the working directory of this file system. 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

The virtual file system interface.

Definition at line 220 of file VirtualFileSystem.h.

Constructor & Destructor Documentation

◆ ~FileSystem()

FileSystem::~FileSystem ( )
virtual

Definition at line 86 of file VirtualFileSystem.cpp.

Member Function Documentation

◆ dir_begin()

virtual directory_iterator clang::vfs::FileSystem::dir_begin ( const Twine &  Dir,
std::error_code &  EC 
)
pure virtual

◆ exists()

bool FileSystem::exists ( const Twine &  Path)

◆ getBufferForFile()

ErrorOr< std::unique_ptr< MemoryBuffer > > FileSystem::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.

Definition at line 89 of file VirtualFileSystem.cpp.

Referenced by DetectDistro(), and clang::driver::toolchains::Generic_GCC::GCCInstallationDetector::getBiarchSibling().

◆ getCurrentWorkingDirectory()

virtual llvm::ErrorOr<std::string> clang::vfs::FileSystem::getCurrentWorkingDirectory ( ) const
pure virtual

Get the working directory of this file system.

Implemented in clang::vfs::InMemoryFileSystem, and clang::vfs::OverlayFileSystem.

◆ makeAbsolute()

std::error_code FileSystem::makeAbsolute ( SmallVectorImpl< char > &  Path) const

Make Path an absolute path.

Makes Path absolute using the current directory if it is not already. An empty Path will result in the current directory.

/absolute/path => /absolute/path relative/../path => <current-directory>/relative/../path

Parameters
PathA path that is modified to be an absolute path.
Returns
success if path has been made absolute, otherwise a platform-specific error_code.

Definition at line 98 of file VirtualFileSystem.cpp.

Referenced by clang::vfs::lookupInMemoryNode(), and clang::vfs::InMemoryFileSystem::setCurrentWorkingDirectory().

◆ openFileForRead()

virtual llvm::ErrorOr<std::unique_ptr<File> > clang::vfs::FileSystem::openFileForRead ( const Twine &  Path)
pure virtual

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

Implemented in clang::vfs::InMemoryFileSystem, and clang::vfs::OverlayFileSystem.

◆ setCurrentWorkingDirectory()

virtual std::error_code clang::vfs::FileSystem::setCurrentWorkingDirectory ( const Twine &  Path)
pure virtual

Set the working directory.

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

Implemented in clang::vfs::InMemoryFileSystem, and clang::vfs::OverlayFileSystem.

◆ status()

virtual llvm::ErrorOr<Status> clang::vfs::FileSystem::status ( const Twine &  Path)
pure virtual

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

Implemented in clang::vfs::InMemoryFileSystem, and clang::vfs::OverlayFileSystem.


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