[PATCH] D117134: [DebugInfo][DWARF][NFC] Move DWARFTypePrinter class to its own file.

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 12 23:31:51 PST 2022


avl added a comment.

In D117134#3239412 <https://reviews.llvm.org/D117134#3239412>, @dblaikie wrote:

> I don't especially object to moving this to a separate file - but maybe it'd be more suitable to have this exposed as a function on DWARFDie, rather than exposing the whole DWARFTypePrinter API?

i.e. something similar to this:

  void DWARFDie::dumpTypeQualifiedName(raw_ostream& OS);
  void DWARFDie::dumpTypeUnqualifiedName(raw_ostream& OS, std::string *OriginalFullName = nullptr);

If that is a preferred variant - I will change the patch accordingly.

Though, The variant with a separate class has an advantage in that it separates dumping functionality from the DWARFDie class.
That is similar to the "Model-View" pattern. If we would add more dumps(for different programming languages, or for different DWARFDie kinds) then we would be necessary to add more dumping functions into the DWARFDie interface, which is probably not a good thing:

  void DWARFDie::dumpSubprogram(raw_ostream& OS);
  void DWARFDie::dumpRanges(raw_ostream& OS);

>From that point of view, using a separate class for dumping probably looks preferable. It allows keeping the DWARFDie interface simpler.
But if adding specific dumping methods to the DWARFDie looks better for us - I am OK to do this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D117134/new/

https://reviews.llvm.org/D117134



More information about the llvm-commits mailing list