[PATCH] D115972: [clang-format] Fix AlignConsecutiveAssignments breaking lambda formatting.

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 31 11:32:22 PST 2022


HazardyKnusperkeks accepted this revision.
HazardyKnusperkeks added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/unittests/Format/FormatTest.cpp:16608
+  //             "auto b            = f(aaaaaaaaaaaaaaaaaaaaaaaaa,\n"
+  //             "           ccc ? aaaaa : bbbbb,\n"
+  //             "           dddddddddddddddddddddddddd);",
----------------
curdeius wrote:
> HazardyKnusperkeks wrote:
> > What determines this indent? I can't see how it should be calculated.
> I didn't think about it before. But now I see, it's computed as in:
> ```
>   verifyFormat("auto b = f(aaaaaaaaaaaaaaaaaaaaaaaaa,\n"
>                "           ccc ? aaaaa : bbbbb,\n"
>                "           dddddddddddddddddddddddddd);",
>                Alignment);
> ```
> i.e. as if there were no alignment at `=` sign. So it's "aligned" to the previous position just after of `f(`.
> 
> Maybe we should align it the same way we do when function arguments don't fit into the line?
> Note, I opened https://github.com/llvm/llvm-project/issues/53497 for it.
> Maybe we should align it the same way we do when function arguments don't fit into the line?

Yes we should. (Next line and add ContinuationIndent, should it be, right?)

But yes, that could be handled in a different commit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115972



More information about the cfe-commits mailing list