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

Marek Kurdej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 31 04:28:25 PST 2022


curdeius added inline comments.


================
Comment at: clang/unittests/Format/FormatTest.cpp:16608
+  //             "auto b            = f(aaaaaaaaaaaaaaaaaaaaaaaaa,\n"
+  //             "           ccc ? aaaaa : bbbbb,\n"
+  //             "           dddddddddddddddddddddddddd);",
----------------
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.


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