[DebugInfo][Support] Replace DWARFDataExtractor size function
authorJames Henderson <james.henderson@sony.com>
Mon, 13 Jan 2020 09:30:52 +0000 (09:30 +0000)
committerJames Henderson <james.henderson@sony.com>
Mon, 13 Jan 2020 10:53:00 +0000 (10:53 +0000)
commitb6ffa2fe1250a8f506cc66044275b0bced56059e
tree4e90d3b012779005afa50bad6fd76bbaeec52bd1
parentadd04b9653848de583c542e0596737f7d7c21553
[DebugInfo][Support] Replace DWARFDataExtractor size function

This patch adds a new size function to the base DataExtractor class,
which removes the need for the DWARFDataExtractor size function.

It is unclear why DWARFDataExtractor's size function returned zero in
some circumstances (i.e. when it is constructed without a section, and
with a different data source instead), so that behaviour has changed.
The old behaviour could cause an assertion in the debug line parser, as
the size did not reflect the actual data available, and could be lower
than the current offset being parsed.

Reviewed by: dblaikie

Differential Revision: https://reviews.llvm.org/D72337
llvm/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h
llvm/include/llvm/Support/DataExtractor.h
llvm/unittests/Support/DataExtractorTest.cpp