Issue 107914
Summary clang-format BraceWrapping.BeforeLambdaBody: True overrides AllowShortLambdasOnASingleLine: All
Labels clang-format
Assignees
Reporter d3matt
    Found a partial workaround here: https://stackoverflow.com/questions/67547349/clang-format-lambda-on-single-line-doesnt-work

It should be possible to have multi-line lambdas require Allman style bracing, but have short lambdas truly be a single line.

Suggest switching BeforeLambdaBody from a boolean to a tri-state (Never, OnlyMultiline, Always). With OnlyMultiLine having the new behavior I'm looking for:
```
auto _oneliner_ = [](auto x){ return 2*x; };
auto multiliner = [](auto x)
{
    if (x %2 == 0)
    {
        return x*2;
 }
    return x*3;
};
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to