================
@@ -366,8 +366,14 @@ bool ContinuationIndenter::mustBreak(const LineState
&State) {
const auto &CurrentState = State.Stack.back();
if (Style.BraceWrapping.BeforeLambdaBody && Current.CanBreakBefore &&
Current.is(TT_LambdaLBrace) && Previous.isNot(TT_LineComment)) {
- auto LambdaBodyLength = getLengthToMatchingParen(Current, State.Stack);
- return LambdaBodyLength > getColumnLimit(State);
+ if (Current.MatchingParen->MustBreakBefore)
----------------
jamesg-nz wrote:
I noticed there is code in `TokenAnnotator` than can set `MustBreakBefore` on
the lambda left brace token:
https://github.com/llvm/llvm-project/blob/0e01c72c5645259d9a08a1a7ed39cb5cc41ce311/clang/lib/Format/TokenAnnotator.cpp#L5297-L5299
Introduced in 37c2233097ac44697b87228d86eef1fce10ea5c1 seemingly for code like
this:
```cpp
auto select = [this]() -> std::unique_ptr<Object> { return
MyAssignment::SelectFromList(this); }
```
Both before this current PR and here the `MustBreakBefore` state of the token
is ignored. Should behavior change to observe this and thus force a break?
Would seem the _BraceWrapping.BeforeLambdaBody_ setting would then force lambda
across multiple lines if on, but not if off.
Should the code in `TokenAnnotator` be changed and maybe only set
`CanBreakBefore`?
https://github.com/llvm/llvm-project/pull/76673
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits