|
LLVM
10.0.0
|
Collects files into a directory and generates a mapping that can be used by the VFS. More...
#include "llvm/Support/FileCollector.h"
Public Member Functions | |
| FileCollector (std::string Root, std::string OverlayRoot) | |
| void | addFile (const Twine &file) |
| std::error_code | writeMapping (StringRef mapping_file) |
| Write the yaml mapping (for the VFS) to the given file. More... | |
| std::error_code | copyFiles (bool StopOnError=true) |
| Copy the files into the root directory. More... | |
Static Public Member Functions | |
| static IntrusiveRefCntPtr< vfs::FileSystem > | createCollectorVFS (IntrusiveRefCntPtr< vfs::FileSystem > BaseFS, std::shared_ptr< FileCollector > Collector) |
| Create a VFS that collects all the paths that might be looked at by the file system accesses. More... | |
Protected Attributes | |
| std::mutex | Mutex |
| Synchronizes adding files. More... | |
| std::string | Root |
| The root directory where files are copied. More... | |
| std::string | OverlayRoot |
| The root directory where the VFS overlay lives. More... | |
| StringSet | Seen |
| Tracks already seen files so they can be skipped. More... | |
| vfs::YAMLVFSWriter | VFSWriter |
| The yaml mapping writer. More... | |
| StringMap< std::string > | SymlinkMap |
| Caches RealPath calls when resolving symlinks. More... | |
Collects files into a directory and generates a mapping that can be used by the VFS.
Definition at line 24 of file FileCollector.h.
| FileCollector::FileCollector | ( | std::string | Root, |
| std::string | OverlayRoot | ||
| ) |
Definition at line 35 of file FileCollector.cpp.
References llvm::sys::path::append(), llvm::sys::fs::create_directories(), llvm::StringMap< ValueTy, AllocatorTy >::end(), llvm::sys::path::filename(), llvm::StringMap< ValueTy, AllocatorTy >::find(), llvm::sys::path::parent_path(), llvm::sys::fs::real_path(), llvm::StringRef::str(), llvm::SmallString< InternalLen >::str(), llvm::SmallVectorImpl< T >::swap(), and SymlinkMap.
Definition at line 64 of file FileCollector.cpp.
References llvm::sys::path::append(), llvm::sys::fs::make_absolute(), llvm::sys::path::native(), llvm::sys::path::relative_path(), llvm::sys::path::remove_dots(), llvm::sys::path::remove_leading_dotslash(), Root, and llvm::Twine::str().
Copy the files into the root directory.
When StopOnError is true (the default) we abort as soon as one file cannot be copied. This is relatively common, for example when a file was removed after it was added to the mapping.
Definition at line 125 of file FileCollector.cpp.
References llvm::sys::fs::copy_file(), copyAccessAndModificationTime(), llvm::sys::fs::create_directories(), llvm::sys::fs::directory_file, entry, llvm::vfs::YAMLVFSWriter::getMappings(), llvm::sys::fs::getPermissions(), llvm::sys::path::parent_path(), llvm::sys::fs::setPermissions(), llvm::sys::fs::status(), llvm::sys::fs::basic_file_status::type(), and VFSWriter.
|
static |
Create a VFS that collects all the paths that might be looked at by the file system accesses.
Definition at line 265 of file FileCollector.cpp.
| std::error_code FileCollector::writeMapping | ( | StringRef | mapping_file | ) |
Write the yaml mapping (for the VFS) to the given file.
Definition at line 174 of file FileCollector.cpp.
References Collector, llvm::vfs::FileSystem::dir_begin(), llvm::sys::fs::directory_file, llvm::X86AS::FS, llvm::vfs::FileSystem::getCurrentWorkingDirectory(), llvm::vfs::FileSystem::getRealPath(), isCaseSensitivePath(), llvm::vfs::FileSystem::isLocal(), llvm::sys::fs::OF_Text, llvm::vfs::FileSystem::openFileForRead(), llvm::sys::fs::openFileForRead(), OverlayRoot, llvm::sys::fs::regular_file, llvm::vfs::YAMLVFSWriter::setCaseSensitivity(), llvm::vfs::FileSystem::setCurrentWorkingDirectory(), llvm::vfs::YAMLVFSWriter::setOverlayDir(), llvm::vfs::YAMLVFSWriter::setUseExternalNames(), llvm::SmallVectorBase::size(), llvm::vfs::FileSystem::status(), llvm::sys::fs::status(), llvm::sys::fs::symlink_file, VFSWriter, and llvm::vfs::YAMLVFSWriter::write().
|
protected |
Synchronizes adding files.
Definition at line 63 of file FileCollector.h.
|
protected |
The root directory where the VFS overlay lives.
Definition at line 69 of file FileCollector.h.
Referenced by writeMapping().
|
protected |
The root directory where files are copied.
Definition at line 66 of file FileCollector.h.
Referenced by addFile().
|
protected |
Tracks already seen files so they can be skipped.
Definition at line 72 of file FileCollector.h.
|
protected |
Caches RealPath calls when resolving symlinks.
Definition at line 78 of file FileCollector.h.
Referenced by FileCollector().
|
protected |
The yaml mapping writer.
Definition at line 75 of file FileCollector.h.
Referenced by copyFiles(), and writeMapping().
1.8.13