[CodeView] Isolate Debug Info Fragments into standalone classes.

Previously parsing of these were all grouped together into a
single master class that could parse any type of debug info
fragment.

With writing forthcoming, the complexity of each individual
fragment is enough to warrant them having their own classes so
that reading and writing of each fragment type can be grouped
together, but isolated from the code for reading and writing
other fragment types.

In doing so, I found a place where parsing code was duplicated
for the FileChecksums fragment, across llvm-readobj and the
CodeView library, and one of the implementations had a bug.
Now that the codepaths are merged, the bug is resolved.

Differential Revision: https://reviews.llvm.org/D32547

llvm-svn: 301557
This commit is contained in:
Zachary Turner
2017-04-27 16:12:16 +00:00
parent e509447418
commit c37cb0c6a5
19 changed files with 513 additions and 328 deletions

View File

@@ -21,6 +21,7 @@
#include <cstdint>
using namespace llvm;
using namespace llvm::codeview;
using namespace llvm::msf;
using namespace llvm::pdb;
@@ -54,7 +55,8 @@ Error ModuleDebugStream::reload() {
return EC;
BinaryStreamReader LineReader(C13LinesSubstream);
if (auto EC = LineReader.readArray(LineInfo, LineReader.bytesRemaining()))
if (auto EC =
LineReader.readArray(LinesAndChecksums, LineReader.bytesRemaining()))
return EC;
uint32_t GlobalRefsSize;
@@ -77,13 +79,13 @@ ModuleDebugStream::symbols(bool *HadError) const {
return make_range(SymbolsSubstream.begin(HadError), SymbolsSubstream.end());
}
iterator_range<codeview::ModuleDebugFragmentArray::Iterator>
ModuleDebugStream::lines(bool *HadError) const {
return make_range(LineInfo.begin(HadError), LineInfo.end());
llvm::iterator_range<ModuleDebugStream::LinesAndChecksumsIterator>
ModuleDebugStream::linesAndChecksums() const {
return make_range(LinesAndChecksums.begin(), LinesAndChecksums.end());
}
bool ModuleDebugStream::hasLineInfo() const {
return C13LinesSubstream.getLength() > 0 || LinesSubstream.getLength() > 0;
return C13LinesSubstream.getLength() > 0;
}
Error ModuleDebugStream::commit() { return Error::success(); }