[PATCH] D44609: [clang-format] New option BeforeLambdaBody to manage lambda line break inside function parameter call (in Allman style)
Francois JEAN via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 26 13:06:45 PST 2020
Wawha added a comment.
In D44609#1893390 <https://reviews.llvm.org/D44609#1893390>, @christophe-calmejane wrote:
> Nice to finally see this patch integrated!
>
> But, it looks like you didn't include all the test case I posted 1.5y ago in this post, that are still problematic and not formatting correctly with your patch:
> For example, this simple case do not format correctly:
>
> paramBeforeAndAfterLambda(8,[](int x){call();},5);
>
>
> The output is:
>
> paramBeforeAndAfterLambda(
> 8,
> [](int x)
> {
> call();
> },
> 5);
>
>
>
> although I would expect to see
>
> paramBeforeAndAfterLambda(8,
> [](int x)
> {
> call();
> },
> 5);
>
>
>
> See my proposed fix in the discussion, but note that I don't think it's clean enough to be accepted :)
Thank for the feedback.
Looking back at your comment and patch, I integrate most of your proposal in order to fix the problem with "noexcept" .
I even have a comment of MyDevelopperDay because I reuse the keyword "auto" for nextTok variable like it was in your proposal :)
For the bug your are reporting with the line wrap for first parameter, looking at the tests I wrote, I see two tests which have should cover that case:
verifyFormat("FctWithMultipleParams_SLS_Empty(A, B,\n"
" []()\n"
" {\n"
" return 17;\n"
" });", LLVMWithBeforeLambdaBody);
verifyFormat("TwoNestedLambdas_SLS_Empty(A,\n"
" []()\n"
" {\n"
" return Call([]() {});\n"
" });", LLVMWithBeforeLambdaBody);
So perhaps there is a mistake, depending of the options or if there is an extra parameter after the lambda.
I do not have a PC in the next 10 Days to check that but I Will try have a look later.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D44609/new/
https://reviews.llvm.org/D44609
More information about the cfe-commits
mailing list