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

Darwin Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 22 19:29:11 PST 2021


darwin added a comment.

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.

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


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