[PATCH] D134453: Disambiguate type names when printing NTTP types

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 26 10:05:51 PDT 2022


dblaikie added a comment.

> it's up to IDE's and good editors and CI log parsers to parse that and present in a possibly better format.

Lots of folks use the diagnostic info from their compiler without IDEs or log parsers doing anything else to them - we should be trying to design these things for usability directly. (SARIF and such are probably the direction to go when producing diagnostics intended to be massaged by tooling in various ways - could provide collapsed views of template type names or these struct literals - comparitive highlighting views (though we do some of that for template type diffing in clang today - maybe one day we'll do that/expand it to cover the struct literals too))

> So we might print it with a syntax as if the class was a simple pod type, even though that might produce a completely different result if used in practice.
> I don't think we can do much better without having the actual expression used.
>
> That might be a point in favor of the designated-initializer style with the field names, that should never produce the wrong result if copy-pasted back to code.

Oh, yeah, I hadn't considered that. :/ that is awkward & something I would certainly place some value in avoiding (was one of the issues I was motivated by in the earlier discussion, that it'd be useful if we produced an identifier that also happened to be valid code - but I wasn't considering the case where we might produce something valid-but-incorrect, just valid being better than invalid - but yeah, invalid being better than valid-but-incorrect).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134453



More information about the cfe-commits mailing list