Before this patch code like this:
if (Class* obj{getObject()}) { }
would be mis-formated since the * would be annotated as a
binaryoperator.
This patch changes the * to become a PointerOrReference instead
and fixes the formatting issues.
Differential D137327
[clang-format] Handle object instansiation in if-statements thieta on Nov 3 2022, 4:23 AM. Authored by
Details Before this patch code like this: if (Class* obj{getObject()}) { } would be mis-formated since the * would be annotated as a This patch changes the * to become a PointerOrReference instead
Diff Detail
Event TimelineComment Actions because of https://github.com/llvm/llvm-project/issues/61785 should this really be reverted? is basically saying X * Y { must be X *Y{ but that obviously not the case Comment Actions Tricky one. Any ideas on how we could differentiate those two cases? Maybe impossible? Not sure what the normal way to handle ambiguous things like that in clang-format is. Comment Actions I would prefer we avoid the regression that this issue caused, even if both are equally viable. because otherwise we get blamed for "changing defaults" @owenpan, @HazardyKnusperkeks what are your thoughts? Comment Actions I have no idea when the release was/is. If it is not released it's a no brainer, revert. Otherwise I'm torn... for everyone skipping this release a revert would change nothing, for those who keep up to date we could be ping-ponging. Can we solve the problem, without knowing what identifiers are types and what are objects/variables for all valid and not pathologic cases? Comment Actions The prior behaviour was there before, it’s marked in GitHub as a regression, can you please revert, we’ll mark the issue to be cherry picked, then let’s go back and rework a solution that means your issue can be resolved Comment Actions Sorry this slipped under my radar. Can you please push a revert to main and then file a issue to backport this to the release branch if it's something you still want to do. It's hard for me to keep track of the issues unless they are added to the 16.x milestone. Comment Actions You have commit rights correct? you really need to own your change especially if it causes a regression. Comment Actions Alright - I did that now. Sorry I am just used to be on the other side as my role as a release manager and I thought you where asking me to revert it in that role. I will see if I find time to add the new Types directive soon. |
Could you add a test for this as well?