From 08bbd35a80bf7765fe0d3043f9eb5a2f2786b649 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 26 Jun 2017 20:32:52 +0000 Subject: Vendor import of llvm trunk r306325: https://llvm.org/svn/llvm-project/llvm/trunk@306325 --- lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp | 36 ++++++++++++++++++++------ 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp') diff --git a/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp b/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp index 4186f2eb6ba01..83c56574a16e5 100644 --- a/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp +++ b/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp @@ -47,15 +47,19 @@ Error ModuleDebugStreamRef::reload() { if (auto EC = Reader.readInteger(Signature)) return EC; - if (auto EC = Reader.readArray(SymbolsSubstream, SymbolSize - 4)) + if (auto EC = Reader.readSubstream(SymbolsSubstream, SymbolSize - 4)) return EC; - - if (auto EC = Reader.readStreamRef(C11LinesSubstream, C11Size)) + if (auto EC = Reader.readSubstream(C11LinesSubstream, C11Size)) + return EC; + if (auto EC = Reader.readSubstream(C13LinesSubstream, C13Size)) return EC; - if (auto EC = Reader.readStreamRef(C13LinesSubstream, C13Size)) + + BinaryStreamReader SymbolReader(SymbolsSubstream.StreamData); + if (auto EC = + SymbolReader.readArray(SymbolArray, SymbolReader.bytesRemaining())) return EC; - BinaryStreamReader SubsectionsReader(C13LinesSubstream); + BinaryStreamReader SubsectionsReader(C13LinesSubstream.StreamData); if (auto EC = SubsectionsReader.readArray(Subsections, SubsectionsReader.bytesRemaining())) return EC; @@ -63,7 +67,7 @@ Error ModuleDebugStreamRef::reload() { uint32_t GlobalRefsSize; if (auto EC = Reader.readInteger(GlobalRefsSize)) return EC; - if (auto EC = Reader.readStreamRef(GlobalRefsSubstream, GlobalRefsSize)) + if (auto EC = Reader.readSubstream(GlobalRefsSubstream, GlobalRefsSize)) return EC; if (Reader.bytesRemaining() > 0) return make_error(raw_error_code::corrupt_file, @@ -72,9 +76,25 @@ Error ModuleDebugStreamRef::reload() { return Error::success(); } +BinarySubstreamRef ModuleDebugStreamRef::getSymbolsSubstream() const { + return SymbolsSubstream; +} + +BinarySubstreamRef ModuleDebugStreamRef::getC11LinesSubstream() const { + return C11LinesSubstream; +} + +BinarySubstreamRef ModuleDebugStreamRef::getC13LinesSubstream() const { + return C13LinesSubstream; +} + +BinarySubstreamRef ModuleDebugStreamRef::getGlobalRefsSubstream() const { + return GlobalRefsSubstream; +} + iterator_range ModuleDebugStreamRef::symbols(bool *HadError) const { - return make_range(SymbolsSubstream.begin(HadError), SymbolsSubstream.end()); + return make_range(SymbolArray.begin(HadError), SymbolArray.end()); } llvm::iterator_range @@ -83,7 +103,7 @@ ModuleDebugStreamRef::subsections() const { } bool ModuleDebugStreamRef::hasDebugSubsections() const { - return C13LinesSubstream.getLength() > 0; + return !C13LinesSubstream.empty(); } Error ModuleDebugStreamRef::commit() { return Error::success(); } -- cgit v1.2.3