diff options
author | Zachary Turner <zturner@google.com> | 2017-06-09 17:54:36 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-06-09 17:54:36 +0000 |
commit | 7e62cd17d6813d66e46e7177574be81c665d8eab (patch) | |
tree | bdab66465650daaa10cf21e6c08222886c2c36c3 /llvm/lib/DebugInfo/CodeView/DebugLinesSubsection.cpp | |
parent | d9de6389fc705fd662b692c6fd3de640b3dc559e (diff) | |
download | llvm-7e62cd17d6813d66e46e7177574be81c665d8eab.zip llvm-7e62cd17d6813d66e46e7177574be81c665d8eab.tar.gz llvm-7e62cd17d6813d66e46e7177574be81c665d8eab.tar.bz2 |
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.
llvm-svn: 305093
Diffstat (limited to 'llvm/lib/DebugInfo/CodeView/DebugLinesSubsection.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/DebugLinesSubsection.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/DebugInfo/CodeView/DebugLinesSubsection.cpp b/llvm/lib/DebugInfo/CodeView/DebugLinesSubsection.cpp index 33a8f78..fbcad61 100644 --- a/llvm/lib/DebugInfo/CodeView/DebugLinesSubsection.cpp +++ b/llvm/lib/DebugInfo/CodeView/DebugLinesSubsection.cpp @@ -17,9 +17,8 @@ using namespace llvm; using namespace llvm::codeview; -Error LineColumnExtractor::extract(BinaryStreamRef Stream, uint32_t &Len, - LineColumnEntry &Item, - const LineFragmentHeader *Header) { +Error LineColumnExtractor::operator()(BinaryStreamRef Stream, uint32_t &Len, + LineColumnEntry &Item) { using namespace codeview; const LineBlockFragmentHeader *BlockHeader; BinaryStreamReader Reader(Stream); @@ -56,8 +55,8 @@ Error DebugLinesSubsectionRef::initialize(BinaryStreamReader Reader) { if (auto EC = Reader.readObject(Header)) return EC; - if (auto EC = - Reader.readArray(LinesAndColumns, Reader.bytesRemaining(), Header)) + LinesAndColumns.getExtractor().Header = Header; + if (auto EC = Reader.readArray(LinesAndColumns, Reader.bytesRemaining())) return EC; return Error::success(); |