This is an archive of the discontinued LLVM Phabricator instance.

[DWARF v5] Refactor range lists dumping (NFC except for spelling changes in dump output).
ClosedPublic

Authored by wolfgangp on Jul 18 2018, 11:22 AM.

Details

Summary

This refactor is motivated by the fact hat DWARF 5 location list tables are identical to range list tables in layout. The only differences are of course the entries themselves, so the code that handles table extraction and dumping of anything other than the entries themselves could be used for location list tables as well.

With that in mind, this proposed change introduces a template class "DWARFListTableBase", with a template parameter that is expected to be either a location list or a range list. The table header is broken out separately since it is not template dependent. The constructor takes 3 strings to identify the section name, a header displayed during dumping and a string characterizing the list as either "location" or "range", also used during dumping.

To facilitate range lists and location lists there is a new template class DWARFListType with the template parameter expected to be a list entry type, such as a location list entry or range list entry.

Finally, there is a small base class DWARFListEntryBase to handle commonalities between list entries.

DebugRnglistTable is now simply derived from DWARFListTableBase instantiated appopriately. I expect to refactor the location list table similarly.

This refactor is NFC, with the exception of the capitalization of words that are emitted during dumping. I decided to make everything lower case for consistency, but that can be easily changed, if there are any objections.

Please feel free to suggest alternatives for "DWARFListTable" and DWARFListType, etc. It feels a bit lacking in descriptiveness.

Diff Detail

Event Timeline

wolfgangp created this revision.Jul 18 2018, 11:22 AM

Can you run clang-format on this patch?

include/llvm/DebugInfo/DWARF/DWARFListTable.h
90

Should we use a StringRef for these?

163

We usually make the DIDumpOptions optional by providing a default value (= {})

  • Used StringRef instead of const char * for some strings displayed during dumping.
  • Formatting
JDevlieghere accepted this revision.Jul 23 2018, 11:35 AM

Other than the DIDumpOptions comment (which I think you might have missed) this LGTM.

This revision is now accepted and ready to land.Jul 23 2018, 11:35 AM
This revision was automatically updated to reflect the committed changes.

Thanks for the review, Jonas. I included the change for the DumpOpts parameter.