diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-11-10 22:44:06 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-11-10 22:44:06 +0000 |
commit | 1cc0714c68438f6ddf78b84599f8e80642a2233a (patch) | |
tree | 8f5101311e228a88b26aec44e303bc0126208a0c /lldb/source/Utility/DataBufferLLVM.cpp | |
parent | 3889c36d3fcc9d1fc7b8426ab8dae05214bf9ba3 (diff) | |
download | bcm5719-llvm-1cc0714c68438f6ddf78b84599f8e80642a2233a.tar.gz bcm5719-llvm-1cc0714c68438f6ddf78b84599f8e80642a2233a.zip |
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
Diffstat (limited to 'lldb/source/Utility/DataBufferLLVM.cpp')
-rw-r--r-- | lldb/source/Utility/DataBufferLLVM.cpp | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/lldb/source/Utility/DataBufferLLVM.cpp b/lldb/source/Utility/DataBufferLLVM.cpp index 713c3c2814e..a31b5b76d2e 100644 --- a/lldb/source/Utility/DataBufferLLVM.cpp +++ b/lldb/source/Utility/DataBufferLLVM.cpp @@ -27,34 +27,6 @@ DataBufferLLVM::DataBufferLLVM( DataBufferLLVM::~DataBufferLLVM() {} -std::shared_ptr<DataBufferLLVM> -DataBufferLLVM::CreateSliceFromPath(const llvm::Twine &Path, uint64_t Size, - uint64_t Offset) { - // If the file resides non-locally, pass the volatile flag so that we don't - // mmap it. - bool IsVolatile = !llvm::sys::fs::is_local(Path); - - auto Buffer = - llvm::WritableMemoryBuffer::getFileSlice(Path, Size, Offset, IsVolatile); - if (!Buffer) - return nullptr; - return std::shared_ptr<DataBufferLLVM>( - new DataBufferLLVM(std::move(*Buffer))); -} - -std::shared_ptr<DataBufferLLVM> -DataBufferLLVM::CreateFromPath(const llvm::Twine &Path) { - // If the file resides non-locally, pass the volatile flag so that we don't - // mmap it. - bool IsVolatile = !llvm::sys::fs::is_local(Path); - - auto Buffer = llvm::WritableMemoryBuffer::getFile(Path, -1, IsVolatile); - if (!Buffer) - return nullptr; - return std::shared_ptr<DataBufferLLVM>( - new DataBufferLLVM(std::move(*Buffer))); -} - uint8_t *DataBufferLLVM::GetBytes() { return reinterpret_cast<uint8_t *>(Buffer->getBufferStart()); } |