This is an archive of the discontinued LLVM Phabricator instance.

DWARF: Move indexing code from DWARFUnit to ManualDWARFIndex
ClosedPublic

Authored by labath on May 23 2018, 5:29 AM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM