[PATCH] D97137: Bug fix of clang-format, the AlignConsecutiveDeclarations option doesn't handle pointer properly

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 23 08:42:19 PST 2021


HazardyKnusperkeks accepted this revision.
HazardyKnusperkeks added a comment.
This revision is now accepted and ready to land.

In D97137#2580664 <https://reviews.llvm.org/D97137#2580664>, @darwin wrote:

> In D97137#2579669 <https://reviews.llvm.org/D97137#2579669>, @HazardyKnusperkeks wrote:
>
>> You should mark comments as done, if they are.
>>
>> Does your modification maybe add something to the alignment which is not a declaration?
>>
>>   int a;
>>   double b;
>>   a * b;
>>
>> How is that formatted? Yeah unlikely that something like that is in code, but it could be if `operator*` has side effects and one does not need the result.
>
> Good question.
>
> I've tested the original code and the modified code, both will generate the same result:
>
>   int    a;
>   double b;
>   a*     b;
>
> I understand the expected format should be:
>
>   int    a;
>   double b;
>   a* b;
>
> Maybe we can register another bug to track it.

If it was formatted like that before, everything is fine by me. clang-format does not know the types (or if it are types) of `a` and `b`.

> For the side effects, I couldn't answer this yet since I am no expert. Can someone take a deep look of it?

If all tests pass this is fine for me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97137



More information about the cfe-commits mailing list