Wawha marked 2 inline comments 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: > 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; }); }); ``` 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