[PATCH] D46707: [DWARF] Factor out a DWARFUnitHeader class. NFC

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 10 15:53:56 PDT 2018


clayborg added inline comments.


================
Comment at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:238
 
-class DWARFUnit {
+class DWARFUnit : public DWARFUnitHeader {
   DWARFContext &Context;
----------------
dblaikie wrote:
> Any chance of composition rather than inheritance? (I realize that'll be a bunch more churn (changing "getLength" to "getHeader().getLength", etc, presumably) - but it seems like the inheritance here isn't accurate - a DWARFUnit is not a DWARFUnitHeader (in the "isa" kind of phrasing/test about inheritance))
> 
> Guess that could be done in a separate patch to make it clearer.
It should be easy as each constructor was taking a "const DWARFUnitHeader &Header" parameter already, so instead of constructing DWARFUnitHeader with it, we could copy or move it into the m_header ivar.


Repository:
  rL LLVM

https://reviews.llvm.org/D46707





More information about the llvm-commits mailing list