diff options
Diffstat (limited to 'source/Utility/DataBufferLLVM.cpp')
-rw-r--r-- | source/Utility/DataBufferLLVM.cpp | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/source/Utility/DataBufferLLVM.cpp b/source/Utility/DataBufferLLVM.cpp index 713c3c2814ea..0ab3fe5afd46 100644 --- a/source/Utility/DataBufferLLVM.cpp +++ b/source/Utility/DataBufferLLVM.cpp @@ -13,8 +13,8 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" -#include <assert.h> // for assert -#include <type_traits> // for move +#include <assert.h> +#include <type_traits> using namespace lldb_private; @@ -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()); } |