#include "lldb/Host/FileSystem.h"
#include "lldb/Utility/DataBufferLLVM.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Program.h"
#include "llvm/Support/Threading.h"
#include <cerrno>
#include <climits>
#include <cstdarg>
#include <cstdio>
#include <fcntl.h>
#ifdef _WIN32
#include "lldb/Host/windows/windows.h"
#else
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <termios.h>
#include <unistd.h>
#endif
#include <algorithm>
#include <fstream>
#include <optional>
#include <vector>
usingnamespacelldb;
usingnamespacelldb_private;
usingnamespacellvm;
FileSystem &FileSystem::Instance() { … }
void FileSystem::Terminate() { … }
std::optional<FileSystem> &FileSystem::InstanceImpl() { … }
vfs::directory_iterator FileSystem::DirBegin(const FileSpec &file_spec,
std::error_code &ec) { … }
vfs::directory_iterator FileSystem::DirBegin(const Twine &dir,
std::error_code &ec) { … }
llvm::ErrorOr<vfs::Status>
FileSystem::GetStatus(const FileSpec &file_spec) const { … }
llvm::ErrorOr<vfs::Status> FileSystem::GetStatus(const Twine &path) const { … }
sys::TimePoint<>
FileSystem::GetModificationTime(const FileSpec &file_spec) const { … }
sys::TimePoint<> FileSystem::GetModificationTime(const Twine &path) const { … }
uint64_t FileSystem::GetByteSize(const FileSpec &file_spec) const { … }
uint64_t FileSystem::GetByteSize(const Twine &path) const { … }
uint32_t FileSystem::GetPermissions(const FileSpec &file_spec) const { … }
uint32_t FileSystem::GetPermissions(const FileSpec &file_spec,
std::error_code &ec) const { … }
uint32_t FileSystem::GetPermissions(const Twine &path) const { … }
uint32_t FileSystem::GetPermissions(const Twine &path,
std::error_code &ec) const { … }
bool FileSystem::Exists(const Twine &path) const { … }
bool FileSystem::Exists(const FileSpec &file_spec) const { … }
bool FileSystem::Readable(const Twine &path) const { … }
bool FileSystem::Readable(const FileSpec &file_spec) const { … }
bool FileSystem::IsDirectory(const Twine &path) const { … }
bool FileSystem::IsDirectory(const FileSpec &file_spec) const { … }
bool FileSystem::IsLocal(const Twine &path) const { … }
bool FileSystem::IsLocal(const FileSpec &file_spec) const { … }
void FileSystem::EnumerateDirectory(Twine path, bool find_directories,
bool find_files, bool find_other,
EnumerateDirectoryCallbackType callback,
void *callback_baton) { … }
std::error_code FileSystem::MakeAbsolute(SmallVectorImpl<char> &path) const { … }
std::error_code FileSystem::MakeAbsolute(FileSpec &file_spec) const { … }
std::error_code FileSystem::GetRealPath(const Twine &path,
SmallVectorImpl<char> &output) const { … }
void FileSystem::Resolve(SmallVectorImpl<char> &path) { … }
void FileSystem::Resolve(FileSpec &file_spec) { … }
template <typename T>
static std::unique_ptr<T> GetMemoryBuffer(const llvm::Twine &path,
uint64_t size, uint64_t offset,
bool is_volatile) { … }
std::shared_ptr<WritableDataBuffer>
FileSystem::CreateWritableDataBuffer(const llvm::Twine &path, uint64_t size,
uint64_t offset) { … }
std::shared_ptr<DataBuffer>
FileSystem::CreateDataBuffer(const llvm::Twine &path, uint64_t size,
uint64_t offset) { … }
std::shared_ptr<WritableDataBuffer>
FileSystem::CreateWritableDataBuffer(const FileSpec &file_spec, uint64_t size,
uint64_t offset) { … }
std::shared_ptr<DataBuffer>
FileSystem::CreateDataBuffer(const FileSpec &file_spec, uint64_t size,
uint64_t offset) { … }
bool FileSystem::ResolveExecutableLocation(FileSpec &file_spec) { … }
bool FileSystem::GetHomeDirectory(SmallVectorImpl<char> &path) const { … }
bool FileSystem::GetHomeDirectory(FileSpec &file_spec) const { … }
static int OpenWithFS(const FileSystem &fs, const char *path, int flags,
int mode) { … }
static int GetOpenFlags(File::OpenOptions options) { … }
static mode_t GetOpenMode(uint32_t permissions) { … }
Expected<FileUP> FileSystem::Open(const FileSpec &file_spec,
File::OpenOptions options,
uint32_t permissions, bool should_close_fd) { … }
void FileSystem::SetHomeDirectory(std::string home_directory) { … }
Status FileSystem::RemoveFile(const FileSpec &file_spec) { … }
Status FileSystem::RemoveFile(const llvm::Twine &path) { … }