Extract construction of DataBufferLLVM into FileSystem

This moves construction of data buffers into the FileSystem class. Like
some of the previous refactorings we don't translate the path yet
because the functionality hasn't been landed in LLVM yet.

Differential revision: https://reviews.llvm.org/D54272

llvm-svn: 346598
This commit is contained in:
Jonas Devlieghere
2018-11-10 22:44:06 +00:00
parent 3889c36d3f
commit 1cc0714c68
18 changed files with 94 additions and 73 deletions

View File

@@ -40,7 +40,6 @@
#include "lldb/Target/Thread.h"
#include "lldb/Utility/Args.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/DataBufferLLVM.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegisterValue.h"
#include "lldb/Utility/RegularExpression.h"
@@ -2544,7 +2543,7 @@ bool RenderScriptRuntime::LoadAllocation(Stream &strm, const uint32_t alloc_id,
}
// Read file into data buffer
auto data_sp = DataBufferLLVM::CreateFromPath(file.GetPath());
auto data_sp = FileSystem::Instance().CreateDataBuffer(file.GetPath());
// Cast start of buffer to FileHeader and use pointer to read metadata
void *file_buf = data_sp->GetBytes();
@@ -3085,7 +3084,8 @@ bool RSModuleDescriptor::ParseRSInfo() {
const addr_t size = info_sym->GetByteSize();
const FileSpec fs = m_module->GetFileSpec();
auto buffer = DataBufferLLVM::CreateSliceFromPath(fs.GetPath(), size, addr);
auto buffer =
FileSystem::Instance().CreateDataBuffer(fs.GetPath(), size, addr);
if (!buffer)
return false;