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

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 10 14:47:13 PDT 2018


dblaikie added inline comments.


================
Comment at: llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h:238
 
-class DWARFUnit {
+class DWARFUnit : public DWARFUnitHeader {
   DWARFContext &Context;
----------------
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.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp:278
+      DWARFUnitHeader Header;
+      Header.extract(DCtx, DebugInfoData, &OffsetStart);
       std::unique_ptr<DWARFUnit> Unit;
----------------
Rather than testing the section inside DWARFUnitHeader::extract - perhaps you could pass down UnitType here?


Repository:
  rL LLVM

https://reviews.llvm.org/D46707





More information about the llvm-commits mailing list