summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/MSF
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-11-27 18:48:37 +0000
committerZachary Turner <zturner@google.com>2017-11-27 18:48:37 +0000
commit96c6985b5327845be772c2bc13567c2967969cc7 (patch)
tree630b1fba2331a97d751864515dfa76eb6f168d15 /llvm/lib/DebugInfo/MSF
parentec6e21427275ce1cdb2580aaa4167b143aab049c (diff)
downloadbcm5719-llvm-96c6985b5327845be772c2bc13567c2967969cc7.tar.gz
bcm5719-llvm-96c6985b5327845be772c2bc13567c2967969cc7.zip
[BinaryStream] Support growable streams.
The existing library assumed that a stream's length would never change. This makes some things simpler, but it's not flexible enough for what we need, especially for writable streams where what you really want is for each call to write to actually append. llvm-svn: 319070
Diffstat (limited to 'llvm/lib/DebugInfo/MSF')
-rw-r--r--llvm/lib/DebugInfo/MSF/MappedBlockStream.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/DebugInfo/MSF/MappedBlockStream.cpp b/llvm/lib/DebugInfo/MSF/MappedBlockStream.cpp
index f28f944131b..dec28eb3069 100644
--- a/llvm/lib/DebugInfo/MSF/MappedBlockStream.cpp
+++ b/llvm/lib/DebugInfo/MSF/MappedBlockStream.cpp
@@ -89,7 +89,7 @@ MappedBlockStream::createFpmStream(const MSFLayout &Layout,
Error MappedBlockStream::readBytes(uint32_t Offset, uint32_t Size,
ArrayRef<uint8_t> &Buffer) {
// Make sure we aren't trying to read beyond the end of the stream.
- if (auto EC = checkOffset(Offset, Size))
+ if (auto EC = checkOffsetForRead(Offset, Size))
return EC;
if (tryReadContiguously(Offset, Size, Buffer))
@@ -167,7 +167,7 @@ Error MappedBlockStream::readBytes(uint32_t Offset, uint32_t Size,
Error MappedBlockStream::readLongestContiguousChunk(uint32_t Offset,
ArrayRef<uint8_t> &Buffer) {
// Make sure we aren't trying to read beyond the end of the stream.
- if (auto EC = checkOffset(Offset, 1))
+ if (auto EC = checkOffsetForRead(Offset, 1))
return EC;
uint32_t First = Offset / BlockSize;
@@ -243,7 +243,7 @@ Error MappedBlockStream::readBytes(uint32_t Offset,
uint32_t OffsetInBlock = Offset % BlockSize;
// Make sure we aren't trying to read beyond the end of the stream.
- if (auto EC = checkOffset(Offset, Buffer.size()))
+ if (auto EC = checkOffsetForRead(Offset, Buffer.size()))
return EC;
uint32_t BytesLeft = Buffer.size();
@@ -388,7 +388,7 @@ uint32_t WritableMappedBlockStream::getLength() {
Error WritableMappedBlockStream::writeBytes(uint32_t Offset,
ArrayRef<uint8_t> Buffer) {
// Make sure we aren't trying to write beyond the end of the stream.
- if (auto EC = checkOffset(Offset, Buffer.size()))
+ if (auto EC = checkOffsetForWrite(Offset, Buffer.size()))
return EC;
uint32_t BlockNum = Offset / getBlockSize();
OpenPOWER on IntegriCloud