[PATCH] D36993: [llvm-dwarfdump] Print type names in DW_AT_type DIEs

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 13:54:26 PDT 2017


JDevlieghere added a comment.

In https://reviews.llvm.org/D36993#855777, @dblaikie wrote:

> In https://reviews.llvm.org/D36993#855144, @JDevlieghere wrote:
>
> > In https://reviews.llvm.org/D36993#854984, @dblaikie wrote:
> >
> > > Where's the 'const' being printed from (couldn't spot it from a quick glance at the code) for the test cases like "const Struct"?
> >
> >
> > The function `dumpTypeTagName` extracts the 'type name' from a tag. For the example the function dumps `DW_TAG_const_type` as `const`.
>
>
> That seems a bit subtle - does that codepath trigger/do things for other tag types, or just const? Especially if it's just const, I'd probably handle const where reference, array, pointer, etc, are handled. Seems clearer.


It works for all tag types, but some (such as pointers and references) are handled explicitly in the switch because we don't want to print their "type name" but rather a `*` or `&`. I totally agree that it's a little subtle. However originally every tag had a corresponding switch case but this was really verbose and not very maintainable. Personally I feel it's worth the trade-off, but I'd definitely be open to a different alternative!


Repository:
  rL LLVM

https://reviews.llvm.org/D36993





More information about the llvm-commits mailing list