summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility/DataBufferLLVM.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-11-12 21:24:50 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-11-12 21:24:50 +0000
commit87e403aa4f62d7385999041abce5fdadb8741a47 (patch)
tree50a1ddaec65b06269d32c1455915f0fd4340f41e /lldb/source/Utility/DataBufferLLVM.cpp
parente565e5a9621de42e7b82ad50803fe03beafa0334 (diff)
downloadbcm5719-llvm-87e403aa4f62d7385999041abce5fdadb8741a47.tar.gz
bcm5719-llvm-87e403aa4f62d7385999041abce5fdadb8741a47.zip
Re-land "Extract construction of DataBufferLLVM into FileSystem"
This fixes some UB in isLocal detected by the sanitized bot. llvm-svn: 346707
Diffstat (limited to 'lldb/source/Utility/DataBufferLLVM.cpp')
-rw-r--r--lldb/source/Utility/DataBufferLLVM.cpp28
1 files changed, 0 insertions, 28 deletions
diff --git a/lldb/source/Utility/DataBufferLLVM.cpp b/lldb/source/Utility/DataBufferLLVM.cpp
index 84870129094..0ab3fe5afd4 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());
}
OpenPOWER on IntegriCloud