[PATCH] D35373: Use delegation instead of inheritance

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 12:35:44 PDT 2017


dblaikie added a comment.

Might be helpful to have a bit of a summary about what's changing here, separate from looking at all the source manually - what operations stayed in DWARFContext{,InMemory} versus those that moved out into DWARFObject?

Do all the operations need wrappers in DWARFContext, or could many of those be removed because they're probably only used internally within DWARFContext & could be replaced with "Obj->thing" instead? (though that's more refactoring/churn, I realize)



================
Comment at: include/llvm/DebugInfo/DWARF/DWARFContext.h:56
+  virtual ~DWARFObj() {}
+  virtual StringRef getFileName() const { llvm_unreachable("unimplemented"); }
+  virtual bool isLittleEndian() const { llvm_unreachable("unimplemented"); }
----------------
Why do these all need default implementations? Guessing there's a reason they're not pure virtual? Though it seems like it'd make using this class more difficult if there are implicit contracts about which subset of operations are implemented and which ones are not?


https://reviews.llvm.org/D35373





More information about the llvm-commits mailing list