[PATCH] Make getUnitForOffset a DWARFUnit method instead of a DWARFContext method.

Alexey Samsonov vonosmas at gmail.com
Thu Sep 11 13:21:04 PDT 2014


================
Comment at: lib/DebugInfo/DWARFUnit.h:202
@@ +201,3 @@
+template<class UnitType>
+class DWARFUnitImpl : public DWARFUnit {
+protected:
----------------
See my suggestion in D5264 review thread. You can introduce a new template class DWARFUnitSection<T>,
which would be a wrapper around SmallVector<std::unique_ptr<T>>, and have
DWARFCompileUnit hold a reference to DWARFUnitSection<DWARFCompileUnit>,
and DWARFTypeUnit hold a reference to DWARFUnitSection<DWARFTypeUnit>.

Then instead of introducing Unit::getUnitForOffset(), you can have an (abstract) DWARFUnit::getSection(), and
DWARFUnitSection::getUnitForOffset().

http://reviews.llvm.org/D5310






More information about the llvm-commits mailing list