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

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 8 06:15:23 PDT 2023


aaron.ballman added a comment.

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

> In D134813#4482822 <https://reviews.llvm.org/D134813#4482822>, @aaron.ballman wrote:
>
>> In D134813#4482819 <https://reviews.llvm.org/D134813#4482819>, @Hahnfeld wrote:
>>
>>> 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.
>
> Oh, alright.
>
>> However, if you prefer they all get handled, it's easy enough!
>
> No, not needed. I was only running into it with an `EnumDecl` while going to LLVM 16. But as I said, it's easy enough to work around.

In general, I think we want to encourage callers to use the variant with a `PrintingPolicy` so that user-controlled options are properly handled (e.g., spelling it `_Bool` instead of `bool` older C modes, that sort of thing), so I figure the extra work is a subtle encouragement. :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134813



More information about the llvm-commits mailing list