[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/PDB/Raw/ModInfo.cpp b/llvm/lib/DebugInfo/PDB/Raw/ModInfo.cpp
index 67dc81d..bae135f 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/ModInfo.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/ModInfo.cpp
@@ -69,28 +69,25 @@
ModInfo::ModInfo() : Layout(nullptr) {}
-ModInfo::ModInfo(codeview::StreamRef Stream) : Layout(nullptr) {
- codeview::StreamReader Reader(Stream);
- if (auto EC = Reader.readObject(Layout)) {
- consumeError(std::move(EC));
- return;
- }
- if (auto EC = Reader.readZeroString(ModuleName)) {
- consumeError(std::move(EC));
- return;
- }
- if (auto EC = Reader.readZeroString(ObjFileName)) {
- consumeError(std::move(EC));
- return;
- }
-}
-
ModInfo::ModInfo(const ModInfo &Info)
: ModuleName(Info.ModuleName), ObjFileName(Info.ObjFileName),
Layout(Info.Layout) {}
ModInfo::~ModInfo() {}
+Error ModInfo::initialize(codeview::StreamRef Stream, ModInfo &Info) {
+ codeview::StreamReader Reader(Stream);
+ if (auto EC = Reader.readObject(Info.Layout))
+ return EC;
+
+ if (auto EC = Reader.readZeroString(Info.ModuleName))
+ return EC;
+
+ if (auto EC = Reader.readZeroString(Info.ObjFileName))
+ return EC;
+ return Error::success();
+}
+
bool ModInfo::hasECInfo() const { return (Layout->Flags & HasECFlagMask) != 0; }
uint16_t ModInfo::getTypeServerIndex() const {