Wawha marked an inline comment as done. Wawha added inline comments.
================ Comment at: lib/Format/ContinuationIndenter.cpp:1307 + (Style.BraceWrapping.BeforeLambdaBody && Current.Next != nullptr && + Current.Next->is(TT_LambdaLSquare))); State.Stack.back().IsInsideObjCArrayLiteral = ---------------- klimek wrote: > Wawha wrote: > > klimek wrote: > > > klimek wrote: > > > > I think I misunderstood some of this the first time around (and thanks > > > > for bearing with me :) - iiuc we want to break for Allman even when > > > > there's only one nested block. I think I'll need to take another look > > > > when I'm back from vacation, unless Daniel or somebody else finds time > > > > before then (will be back in 1.5 weeks) > > > So, HasMultipleNestedBlocks should only be true if there are multiple > > > nested blocks. > > > What tests break if you remove this change to HasMultipleNestedBlocks? > > All cases with only one lambda in parameter are break. The Lambda body with > > be put on the same line as the function and aligned with [] instead of > > putting the body [] on another line with just one simple indentation. > > > > So if restore the line to : > > > > ``` > > State.Stack.back().HasMultipleNestedBlocks = Current.BlockParameterCount > > > 1; > > ``` > > > > Here some cases. > > FormatTest.cpp, ligne 11412: > > > > ``` > > // With my modification > > FunctionWithOneParam( > > []() > > { > > // A cool function... > > return 43; > > }); > > > > // Without my modification > > FunctionWithOneParam([]() > > { > > // A cool function... > > return 43; > > }); > > ``` > > The "{" block of the lambda will be aligned on the "[" depending of the > > function name length. > > > > > > You have the same case with multiple lambdas (FormatTest.cpp, ligne 11433): > > > > ``` > > // With my modification > > TwoNestedLambdas( > > []() > > { > > return Call( > > []() > > { > > return 17; > > }); > > }); > > > > // Without my modification > > TwoNestedLambdas([]() > > { > > return Call([]() > > { > > return 17; > > }); > > }); > > ``` > Do we want to always break before lambdas in Allman style? Perhaps not always. I make that current implementation, because, I have some difficulty to make the other. I alreay tried to modified the code to have that : ``` TwoNestedLambdas([]() { return Call( []() { return 17; }); }); ``` With just a tabulation after the line return. But with no success for the moment. I could try again to implement it, and why not, add an option to tell if we break or not before the lambda. And set it to false by default. Repository: rC Clang https://reviews.llvm.org/D44609 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits