This commit moves the Unit lookup code from the DWARFContext into
a static member of the DWARFUnit. Using a CRTP, each Unit embeds
a reference to the vector of all Units extracted from the same
section. This vector is qureried in getUnitForOffset in order to
be able to extract DIEs referenced from a foreign Unit (this happens
with LTO type uniquing for example). This works whatever the Unit's
origin: .debug_info, .debug_types or their dwo variants.
The DWARFContext API is left untouched by forwarding it lookup code
to the DWARFUnit static member.
This code will be exercised/tested in a followup patch that makes
dwarfdump emit the name for DW_AT_abstract_origin and DW_AT_specification
attributes.
Note that this commit contains a fixed version of the unit lookup code
that hasn't been approved yet.
You shouldn't need to specify UnitType here, should you? Template argument deduction should fire on the first parameter. (similarly at the other call site)