<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 11, 2014 at 1:21 PM, Alexey Samsonov <span dir="ltr"><<a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">================<br>
Comment at: lib/DebugInfo/DWARFUnit.h:202<br>
@@ +201,3 @@<br>
+template<class UnitType><br>
+class DWARFUnitImpl : public DWARFUnit {<br>
+protected:<br>
----------------<br>
See my suggestion in D5264 review thread. You can introduce a new template class DWARFUnitSection<T>,<br>
which would be a wrapper around SmallVector<std::unique_ptr<T>>, and have<br>
DWARFCompileUnit hold a reference to DWARFUnitSection<DWARFCompileUnit>,<br>
and DWARFTypeUnit hold a reference to DWARFUnitSection<DWARFTypeUnit>.<br>
<br>
Then instead of introducing Unit::getUnitForOffset(), you can have an (abstract) DWARFUnit::getSection(),</blockquote><div><br></div><div>Problem here is that getSection would return a different type depending on the DWARFUnit (because it could be a DWARFUnitSection<DWARFCompileUnit> or a DWARFUnitSection<DWARFTypeUnit> - so you'd probably still end up with a CRTP-esque base implementing getUnitForOffset and containing the DWARFUnitSection<DerivedUnitType>&).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> and<br>
DWARFUnitSection::getUnitForOffset().<br>
<br>
<a href="http://reviews.llvm.org/D5310" target="_blank">http://reviews.llvm.org/D5310</a><br>
<br>
<br>
</blockquote></div><br></div></div>