diff options
author | Zachary Turner <zturner@google.com> | 2016-05-28 05:21:57 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2016-05-28 05:21:57 +0000 |
commit | 0d43c1c339ab5532c4527e92dc852b6e0f3f1788 (patch) | |
tree | 321e2a7cb797ccc76f6d806872e8a12ee8fd475b /llvm/lib/DebugInfo/PDB/Raw/ModInfo.cpp | |
parent | 9a9a3169e35306f396e2d690b157ad03a9521650 (diff) | |
download | bcm5719-llvm-0d43c1c339ab5532c4527e92dc852b6e0f3f1788.tar.gz bcm5719-llvm-0d43c1c339ab5532c4527e92dc852b6e0f3f1788.zip |
[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
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/ModInfo.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/PDB/Raw/ModInfo.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/ModInfo.cpp b/llvm/lib/DebugInfo/PDB/Raw/ModInfo.cpp index 67dc81da63a..bae135f77bc 100644 --- a/llvm/lib/DebugInfo/PDB/Raw/ModInfo.cpp +++ b/llvm/lib/DebugInfo/PDB/Raw/ModInfo.cpp @@ -69,28 +69,25 @@ struct ModInfo::FileLayout { 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 { |