LLVM: llvm::vfs::InMemoryFileSystem Class Reference (original) (raw)

An in-memory file system. More...

#include "[llvm/Support/VirtualFileSystem.h](VirtualFileSystem%5F8h%5Fsource.html)"

Public Member Functions
InMemoryFileSystem (bool UseNormalizedPaths=true)
~InMemoryFileSystem () override
bool addFile (const Twine &Path, time_t ModificationTime, std::unique_ptr< llvm::MemoryBuffer > Buffer, std::optional< uint32_t > User=std::nullopt, std::optional< uint32_t > Group=std::nullopt, std::optional< llvm::sys::fs::file_type > Type=std::nullopt, std::optional< llvm::sys::fs::perms > Perms=std::nullopt)
Add a file containing a buffer or a directory to the VFS with a path.
bool addHardLink (const Twine &NewLink, const Twine &Target)
Add a hard link to a file.
bool addSymbolicLink (const Twine &NewLink, const Twine &Target, time_t ModificationTime, std::optional< uint32_t > User=std::nullopt, std::optional< uint32_t > Group=std::nullopt, std::optional< llvm::sys::fs::perms > Perms=std::nullopt)
Add a symbolic link.
bool addFileNoOwn (const Twine &Path, time_t ModificationTime, const llvm::MemoryBufferRef &Buffer, std::optional< uint32_t > User=std::nullopt, std::optional< uint32_t > Group=std::nullopt, std::optional< llvm::sys::fs::file_type > Type=std::nullopt, std::optional< llvm::sys::fs::perms > Perms=std::nullopt)
Add a buffer to the VFS with a path.
std::string toString () const
bool useNormalizedPaths () const
Return true if this file system normalizes . and .. in paths.
llvm::ErrorOr< Status > status (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 getRealPath (const Twine &Path, SmallVectorImpl< char > &Output) override
Canonicalizes Path by combining with the current working directory and normalizing the path (e.g.
std::error_code isLocal (const Twine &Path, bool &Result) override
std::error_code setCurrentWorkingDirectory (const Twine &Path) override
Public Member Functions inherited from llvm::RTTIExtends< InMemoryFileSystem, FileSystem >
const void * dynamicClassID () const override
bool isA () const
Check whether this instance is a subclass of QueryT.
Static Public Attributes
static const char ID = 0
static constexpr size_t MaxSymlinkDepth = 16
Arbitrary max depth to search through symlinks.

An in-memory file system.

Definition at line 541 of file VirtualFileSystem.h.

llvm::vfs::InMemoryFileSystem::InMemoryFileSystem ( bool UseNormalizedPaths = true) explicit

~InMemoryFileSystem()

llvm::vfs::InMemoryFileSystem::~InMemoryFileSystem ( ) overridedefault

addFile()

addFileNoOwn()

Add a hard link to a file.

Here hard links are not intended to be fully equivalent to the classical filesystem. Both the hard link and the file share the same buffer and status (and thus have the same UniqueID). Because of this there is no way to distinguish between the link and the file after the link has been added.

The [Target](classllvm%5F1%5F1Target.html "Target - Wrapper for Target specific information.") path must be an existing file or a hardlink. The NewLink file must not have been added before. The [Target](classllvm%5F1%5F1Target.html "Target - Wrapper for Target specific information.") path must not be a directory. The NewLink node is added as a hard link which points to the resolved file of [Target](classllvm%5F1%5F1Target.html "Target - Wrapper for Target specific information.") node.

Returns

true if the above condition is satisfied and hardlink was successfully created, false otherwise.

Definition at line 1042 of file VirtualFileSystem.cpp.

References llvm::cast(), llvm::isa(), llvm::vfs::detail::NewInMemoryNodeInfo::Path, and llvm::StringRef::str().

Referenced by ~InMemoryFileSystem().

dir_begin()

getCurrentWorkingDirectory()

llvm::ErrorOr< std::string > llvm::vfs::InMemoryFileSystem::getCurrentWorkingDirectory ( ) const inlineoverride

getRealPath()

isLocal()

std::error_code llvm::vfs::InMemoryFileSystem::isLocal ( const Twine & Path, bool & Result ) override

openFileForRead()

printImpl()

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

setCurrentWorkingDirectory()

std::error_code llvm::vfs::InMemoryFileSystem::setCurrentWorkingDirectory ( const Twine & Path) override

status()

toString()

std::string llvm::vfs::InMemoryFileSystem::toString ( ) const

useNormalizedPaths()

bool llvm::vfs::InMemoryFileSystem::useNormalizedPaths ( ) const inline

ID

MaxSymlinkDepth

size_t llvm::vfs::InMemoryFileSystem::MaxSymlinkDepth = 16 staticconstexpr

Arbitrary max depth to search through symlinks.

We can get into problems if a link links to a link that links back to the link, for example.

Definition at line 604 of file VirtualFileSystem.h.


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