================ @@ -325,13 +325,30 @@ bool ContinuationIndenter::canBreak(const LineState &State) { if (Current.isMemberAccess() && CurrentState.ContainsUnwrappedBuilder) return false; - // Don't create a 'hanging' indent if there are multiple blocks in a single - // statement and we are aligning lambda blocks to their signatures. - if (Previous.is(tok::l_brace) && State.Stack.size() > 1 && + // Force a lambda onto a new line so that we don't create a 'hanging' indent + // if there are multiple blocks in a single statement and we are aligning + // lambda blocks to their signatures. + if (Previous.is(tok::l_brace) && State.Stack.size() > 2 && ---------------- rmarker wrote:
I think that it is alright, and that in the situations this code targets it should always be true. The added check below looks further up the stack, so this ensures that it is always valid. I considered adding separate handling for the case of a smaller stack, but thought that it might just be making the code more complex for no gain. If a case is found where it does cause a formatting regression, it should be easy enough to fix by adding in such handling. I.e. ```cpp if (Previous.is(tok::l_brace) && State.Stack.size() > 1 && State.Stack[State.Stack.size() - 2].NestedBlockInlined && State.Stack[State.Stack.size() - 2].HasMultipleNestedBlocks && Style.LambdaBodyIndentation == FormatStyle::LBI_Signature) { if (State.Stack.size() == 2) return false; ``` https://github.com/llvm/llvm-project/pull/141576 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits