DWARF: Move indexing code from DWARFUnit to ManualDWARFIndex

Authored by labath on May 24 2018, 5:12 AM.


DWARF: Move indexing code from DWARFUnit to ManualDWARFIndex

I think this makes sense for several reasons:

  • better separation of concerns: DWARFUnit's job should be to provide a nice interface to its users to access the unit contents. ManualDWARFIndex can then use this interface to build an index and provide it to its users.
  • closer alignment with llvm parsers: there is no indexing equivalent in llvm, and there probably never will be, as the index is very centered around how lldb wants to access debug info. If we ever switch to llvm's parser, this will allow us swap out DWARFUnit implementations and keep indexing as-is.
  • closer proximity of the indexing code to AppleDWARFIndex will make it easier to keep the two in sync (e.g. right now the two use very different algorithms to determine whether a DW_TAG_subroutine represents a "method"). This is my primary motivation for making this change now, but I am leaving this work to a separate patch.

The only interface change to DWARFUnit I needed to make was to add an
efficient way to iterate over the list of all DIEs. Adding this also
aligns us closer to the llvm parser.

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: lldb-commits

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

llvm-svn: 333178


labathMay 24 2018, 5:12 AM
Differential Revision
D47253: DWARF: Move indexing code from DWARFUnit to ManualDWARFIndex
rG93d7b130f900: [Support] Move header to WithColor header