diff options
Diffstat (limited to 'lldb/source/Host')
-rw-r--r-- | lldb/source/Host/common/FileSystem.cpp | 38 | ||||
-rw-r--r-- | lldb/source/Host/common/Host.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Host/linux/Host.cpp | 3 |
3 files changed, 3 insertions, 40 deletions
diff --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp index 95b453073cc..a9ed5bd1847 100644 --- a/lldb/source/Host/common/FileSystem.cpp +++ b/lldb/source/Host/common/FileSystem.cpp @@ -135,16 +135,6 @@ bool FileSystem::IsDirectory(const FileSpec &file_spec) const { return IsDirectory(file_spec.GetPath()); } -bool FileSystem::IsLocal(const Twine &path) const { - bool b; - m_fs->isLocal(path, b); - return b; -} - -bool FileSystem::IsLocal(const FileSpec &file_spec) const { - return IsLocal(file_spec.GetPath()); -} - void FileSystem::EnumerateDirectory(Twine path, bool find_directories, bool find_files, bool find_other, EnumerateDirectoryCallbackType callback, @@ -228,34 +218,6 @@ void FileSystem::Resolve(FileSpec &file_spec) { file_spec.SetIsResolved(true); } -std::shared_ptr<DataBufferLLVM> -FileSystem::CreateDataBuffer(const llvm::Twine &path, uint64_t size, - uint64_t offset) { - const bool is_volatile = !IsLocal(path); - - std::unique_ptr<llvm::WritableMemoryBuffer> buffer; - if (size == 0) { - auto buffer_or_error = - llvm::WritableMemoryBuffer::getFile(path, -1, is_volatile); - if (!buffer_or_error) - return nullptr; - buffer = std::move(*buffer_or_error); - } else { - auto buffer_or_error = llvm::WritableMemoryBuffer::getFileSlice( - path, size, offset, is_volatile); - if (!buffer_or_error) - return nullptr; - buffer = std::move(*buffer_or_error); - } - return std::shared_ptr<DataBufferLLVM>(new DataBufferLLVM(std::move(buffer))); -} - -std::shared_ptr<DataBufferLLVM> -FileSystem::CreateDataBuffer(const FileSpec &file_spec, uint64_t size, - uint64_t offset) { - return CreateDataBuffer(file_spec.GetPath(), size, offset); -} - bool FileSystem::ResolveExecutableLocation(FileSpec &file_spec) { // If the directory is set there's nothing to do. const ConstString &directory = file_spec.GetDirectory(); diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index 55d174c9057..11af400a41b 100644 --- a/lldb/source/Host/common/Host.cpp +++ b/lldb/source/Host/common/Host.cpp @@ -564,7 +564,7 @@ Status Host::RunShellCommand(const Args &args, const FileSpec &working_dir, "shell command output is too large to fit into a std::string"); } else { auto Buffer = - FileSystem::Instance().CreateDataBuffer(output_file_spec); + DataBufferLLVM::CreateFromPath(output_file_spec.GetPath()); if (error.Success()) command_output_ptr->assign(Buffer->GetChars(), Buffer->GetByteSize()); diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp index bd596f8cbfe..1008706bd13 100644 --- a/lldb/source/Host/linux/Host.cpp +++ b/lldb/source/Host/linux/Host.cpp @@ -28,6 +28,7 @@ #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/linux/Support.h" +#include "lldb/Utility/DataBufferLLVM.h" #include "lldb/Utility/DataExtractor.h" using namespace lldb; @@ -121,7 +122,7 @@ static bool IsDirNumeric(const char *dname) { static ArchSpec GetELFProcessCPUType(llvm::StringRef exe_path) { Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); - auto buffer_sp = FileSystem::Instance().CreateDataBuffer(exe_path, 0x20, 0); + auto buffer_sp = DataBufferLLVM::CreateSliceFromPath(exe_path, 0x20, 0); if (!buffer_sp) return ArchSpec(); |