[clang] [Clang][Parser] Don't always destroy template annotations at the end of a declaration (PR #89494)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 22 10:18:41 PDT 2024


AaronBallman wrote:

> > One question I have is whether it would make sense to modify DestroyTemplateIdAnnotationsRAIIObj to not call MaybeDestroyTemplateIds() in the first place
> 
> I’d love to try if it were feasible, but please note that the annotation (that is, C from the parameter header ‘C Default = decltype(lambda)’ in this case; sorry I’m typing on the phone) was deleted by a direct call to MaybeDestroyTemplateIds, not using the RAII object. I tried to teach DestroyTemplateIdAnnotationsRAIIObj to have opt-in destruction, but I soon realized that would introduce more complexity/changes to callers of ParseStatementOrDeclaration, because that function isn’t aware of the context if it should clean up annotations immediately.

Ah! Thank you for the explanation!

https://github.com/llvm/llvm-project/pull/89494


More information about the cfe-commits mailing list