diff options
author | Zachary Turner <zturner@google.com> | 2017-06-23 16:38:40 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-06-23 16:38:40 +0000 |
commit | a1dcb85ddea649d7dd144b03ede60a9c94b985ca (patch) | |
tree | 3bb3a29d17d7f17e46b828784334ee29219625bc /llvm/lib/Support/BinaryStreamReader.cpp | |
parent | 6e85e92b6c63669c2c7f316fb744d828d17130cd (diff) | |
download | bcm5719-llvm-a1dcb85ddea649d7dd144b03ede60a9c94b985ca.tar.gz bcm5719-llvm-a1dcb85ddea649d7dd144b03ede60a9c94b985ca.zip |
Add a BinarySubstreamRef, and a method to read one.
This is essentially just a BinaryStreamRef packaged with an
offset and the logic for reading one is no different than the
logic for reading a BinaryStreamRef, except that we save the
current offset.
llvm-svn: 306122
Diffstat (limited to 'llvm/lib/Support/BinaryStreamReader.cpp')
-rw-r--r-- | llvm/lib/Support/BinaryStreamReader.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Support/BinaryStreamReader.cpp b/llvm/lib/Support/BinaryStreamReader.cpp index bfb658cfa0b..e00527f2519 100644 --- a/llvm/lib/Support/BinaryStreamReader.cpp +++ b/llvm/lib/Support/BinaryStreamReader.cpp @@ -109,6 +109,12 @@ Error BinaryStreamReader::readStreamRef(BinaryStreamRef &Ref, uint32_t Length) { return Error::success(); } +Error BinaryStreamReader::readSubstream(BinarySubstreamRef &Stream, + uint32_t Size) { + Stream.Offset = getOffset(); + return readStreamRef(Stream.StreamData, Size); +} + Error BinaryStreamReader::skip(uint32_t Amount) { if (Amount > bytesRemaining()) return make_error<BinaryStreamError>(stream_error_code::stream_too_short); |