[pdb] Finish conversion to zero copy pdb access.
This converts remaining uses of ByteStream, which was still
left in the symbol stream and type stream, to using the new
StreamInterface zero-copy classes.
RecordIterator is finally deleted, so this is the only way left
now. Additionally, more error checking is added when iterating
the various streams.
With this, the transition to zero copy pdb access is complete.
llvm-svn: 271101
diff --git a/llvm/lib/DebugInfo/CodeView/StreamReader.cpp b/llvm/lib/DebugInfo/CodeView/StreamReader.cpp
index 64985bf..94a6183 100644
--- a/llvm/lib/DebugInfo/CodeView/StreamReader.cpp
+++ b/llvm/lib/DebugInfo/CodeView/StreamReader.cpp
@@ -17,20 +17,13 @@
StreamReader::StreamReader(const StreamInterface &S) : Stream(S), Offset(0) {}
-Error StreamReader::readBytes(uint32_t Size, ArrayRef<uint8_t> &Buffer) {
+Error StreamReader::readBytes(ArrayRef<uint8_t> &Buffer, uint32_t Size) {
if (auto EC = Stream.readBytes(Offset, Size, Buffer))
return EC;
Offset += Size;
return Error::success();
}
-Error StreamReader::readBytes(MutableArrayRef<uint8_t> Buffer) {
- if (auto EC = Stream.readBytes(Offset, Buffer))
- return EC;
- Offset += Buffer.size();
- return Error::success();
-}
-
Error StreamReader::readInteger(uint16_t &Dest) {
const support::ulittle16_t *P;
if (auto EC = readObject(P))
@@ -63,7 +56,7 @@
setOffset(OriginalOffset);
ArrayRef<uint8_t> Data;
- if (auto EC = readBytes(Length, Data))
+ if (auto EC = readBytes(Data, Length))
return EC;
Dest = StringRef(reinterpret_cast<const char *>(Data.begin()), Data.size());
@@ -74,7 +67,7 @@
Error StreamReader::readFixedString(StringRef &Dest, uint32_t Length) {
ArrayRef<uint8_t> Bytes;
- if (auto EC = readBytes(Length, Bytes))
+ if (auto EC = readBytes(Bytes, Length))
return EC;
Dest = StringRef(reinterpret_cast<const char *>(Bytes.begin()), Bytes.size());
return Error::success();