Allow VarStreamArray to use stateful extractors.

Previously extractors tried to be stateless with any additional
context information needed in order to parse items being passed
in via the extraction method.  This led to quite cumbersome
implementation challenges and awkwardness of use.  This patch
brings back support for stateful extractors, making the
implementation and usage simpler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305093 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Zachary Turner
2017-06-09 17:54:36 +00:00
parent 3028aaffc2
commit 4b665d2445
15 changed files with 143 additions and 217 deletions
@@ -17,9 +17,8 @@
using namespace llvm;
using namespace llvm::codeview;
Error VarStreamArrayExtractor<InlineeSourceLine>::extract(
BinaryStreamRef Stream, uint32_t &Len, InlineeSourceLine &Item,
bool HasExtraFiles) {
Error VarStreamArrayExtractor<InlineeSourceLine>::
operator()(BinaryStreamRef Stream, uint32_t &Len, InlineeSourceLine &Item) {
BinaryStreamReader Reader(Stream);
if (auto EC = Reader.readObject(Item.Header))
@@ -44,8 +43,8 @@ Error DebugInlineeLinesSubsectionRef::initialize(BinaryStreamReader Reader) {
if (auto EC = Reader.readEnum(Signature))
return EC;
if (auto EC =
Reader.readArray(Lines, Reader.bytesRemaining(), hasExtraFiles()))
Lines.getExtractor().HasExtraFiles = hasExtraFiles();
if (auto EC = Reader.readArray(Lines, Reader.bytesRemaining()))
return EC;
assert(Reader.bytesRemaining() == 0);