DWARFVerifier: Don't parse all units twice
Introduced/discussed in https://reviews.llvm.org/D38719 The header validation logic was also explicitly building the DWARFUnits to validate. But then other calls, like "Units.getUnitForOffset" creates the DWARFUnits again in the DWARFContext proper - so, let's avoid creating the DWARFUnits twice by walking the DWARFContext's units rather than building a new list explicitly. This does reduce some verifier power - it means that any unit with a header parsing failure won't get further validation, whereas the verifier-created units were getting some further validation despite invalid headers. I don't think this is a great loss/seems "right" in some ways to me that if the header's invalid we should stop there. Exposing the raw DWARFUnitVectors from DWARFContext feels a bit sub-optimal, but gave simple access to the getUnitForOffset to keep the rest of the code fairly similar.
Loading
Please sign in to comment