clang
6.0.0
|
An in-memory file system. More...
#include "clang/Basic/VirtualFileSystem.h"
Public Member Functions | |
InMemoryFileSystem (bool UseNormalizedPaths=true) | |
~InMemoryFileSystem () override | |
bool | addFile (const Twine &Path, time_t ModificationTime, std::unique_ptr< llvm::MemoryBuffer > Buffer, Optional< uint32_t > User=None, Optional< uint32_t > Group=None, Optional< llvm::sys::fs::file_type > Type=None, Optional< llvm::sys::fs::perms > Perms=None) |
Add a file containing a buffer or a directory to the VFS with a path. More... | |
bool | addFileNoOwn (const Twine &Path, time_t ModificationTime, llvm::MemoryBuffer *Buffer, Optional< uint32_t > User=None, Optional< uint32_t > Group=None, Optional< llvm::sys::fs::file_type > Type=None, Optional< llvm::sys::fs::perms > Perms=None) |
Add a buffer to the VFS with a path. More... | |
std::string | toString () const |
bool | useNormalizedPaths () const |
Return true if this file system normalizes . and .. in paths. More... | |
llvm::ErrorOr< Status > | status (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... | |
![]() | |
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... | |
An in-memory file system.
Definition at line 313 of file VirtualFileSystem.h.
Definition at line 482 of file VirtualFileSystem.cpp.
|
override |
Definition at line 489 of file VirtualFileSystem.cpp.
bool clang::vfs::InMemoryFileSystem::addFile | ( | const Twine & | Path, |
time_t | ModificationTime, | ||
std::unique_ptr< llvm::MemoryBuffer > | Buffer, | ||
Optional< uint32_t > | User = None , |
||
Optional< uint32_t > | Group = None , |
||
Optional< llvm::sys::fs::file_type > | Type = None , |
||
Optional< llvm::sys::fs::perms > | Perms = None |
||
) |
Add a file containing a buffer or a directory to the VFS with a path.
The VFS owns the buffer. If present, User, Group, Type and Perms apply to the newly-created file or directory.
Definition at line 495 of file VirtualFileSystem.cpp.
bool clang::vfs::InMemoryFileSystem::addFileNoOwn | ( | const Twine & | Path, |
time_t | ModificationTime, | ||
llvm::MemoryBuffer * | Buffer, | ||
Optional< uint32_t > | User = None , |
||
Optional< uint32_t > | Group = None , |
||
Optional< llvm::sys::fs::file_type > | Type = None , |
||
Optional< llvm::sys::fs::perms > | Perms = None |
||
) |
Add a buffer to the VFS with a path.
The VFS does not own the buffer. If present, User, Group, Type and Perms apply to the newly-created file or directory.
Definition at line 574 of file VirtualFileSystem.cpp.
|
overridevirtual |
Get a directory_iterator for Dir
.
Implements clang::vfs::FileSystem.
Definition at line 671 of file VirtualFileSystem.cpp.
References clang::vfs::lookupInMemoryNode(), clang::make_error_code(), and Node.
|
inlineoverridevirtual |
Get the working directory of this file system.
Implements clang::vfs::FileSystem.
Definition at line 354 of file VirtualFileSystem.h.
References clang::vfs::getNextVirtualUniqueID(), and clang::vfs::getVFSFromYAML().
|
overridevirtual |
Get a File
object for the file at Path
, if one exists.
Implements clang::vfs::FileSystem.
Definition at line 633 of file VirtualFileSystem.cpp.
References clang::vfs::detail::InMemoryDirectory::const_iterator, clang::vfs::lookupInMemoryNode(), clang::make_error_code(), and Node.
|
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 686 of file VirtualFileSystem.cpp.
References clang::vfs::FileSystem::makeAbsolute(), and useNormalizedPaths().
|
overridevirtual |
Get the status of the entry at Path
, if one exists.
Implements clang::vfs::FileSystem.
Definition at line 625 of file VirtualFileSystem.cpp.
References clang::vfs::lookupInMemoryNode(), and Node.
std::string clang::vfs::InMemoryFileSystem::toString | ( | ) | const |
Definition at line 491 of file VirtualFileSystem.cpp.
|
inline |
Return true if this file system normalizes . and .. in paths.
Definition at line 348 of file VirtualFileSystem.h.
Referenced by clang::vfs::lookupInMemoryNode(), and setCurrentWorkingDirectory().