[PATCH] D134813: Properly print unnamed TagDecl objects in diagnostics

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 8 06:09:08 PDT 2023


aaron.ballman added a comment.

In D134813#4482819 <https://reviews.llvm.org/D134813#4482819>, @Hahnfeld wrote:

> In D134813#4482808 <https://reviews.llvm.org/D134813#4482808>, @aaron.ballman wrote:
>
>> In D134813#4482674 <https://reviews.llvm.org/D134813#4482674>, @Hahnfeld wrote:
>>
>>> Out of curiosity, not sure if it's worth fixing because it's easy enough to work around: I think after this change, it's not possible anymore to call `printName(raw_ostream &OS)` on a (statically typed) `TagDecl` / `EnumDecl` because it's hidden by `TagDecl::printName(raw_ostream &OS, const PrintingPolicy &Policy)` while it works perfectly for a `NamedDecl`. Is this intentional?
>>
>> That's not intentional, thank you for pointing it out! This should be corrected in 0566791ab28b5b842c3befea63d7d47fe9ba1a59 <https://reviews.llvm.org/rG0566791ab28b5b842c3befea63d7d47fe9ba1a59>
>
> Thanks! Note that the same probably holds true (but I didn't test) for all other classes that override `printName(raw_ostream &OS, const PrintingPolicy &Policy)`, ie `DecompositionDecl`, `MSGuidDecl`, `UnnamedGlobalConstantDecl`, and `TemplateParamObjectDecl`.

You're correct, but I figured those are somewhat uncommon AST nodes, so we can probably expose those APIs as-needed rather than doing all of them. However, if you prefer they all get handled, it's easy enough!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134813



More information about the cfe-commits mailing list