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.
Should we use a StringRef for these?