[PATCH] D52676: [clang-format] tweaked another case of lambda formatting
    Krasimir Georgiev via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Sat Sep 29 08:32:00 PDT 2018
    
    
  
krasimir added a comment.
In https://reviews.llvm.org/D52676#1249828, @oleg.smolsky wrote:
> In https://reviews.llvm.org/D52676#1249784, @krasimir wrote:
>
> > IMO `BinPackArguments==false` does not imply that there should be a line break before the first arguments, only that there should not be two arguments from the same argument list that appear on the same line.
>
>
> That's right. However consider the following points:
>
> 1. a lambda function is already placed onto its own line when it is the first arg (as you can see in the first test)
I believe that a newline before a first arg lambda is controlled by a different mechanism independent of bin packing, probably by a rule that is more general than just "newline before first arg lambda". I think djasper@ could know more about this case.
> 1. the other args are placed onto a distinct line
> 2. this behavior looks very close to "bin packing"
> 3. adding a new option for the minor cases seems to be an overkill
> 
>   Having said that, I can add a new explicit style option. Do you think that will improve consensus? Would you expect test cases for positive and negative values of the option?
I don't see how the example before:
  void f() {
    something->Method2s(1,
                        [this] {
                          Do1();
                          Do2();
                        },
                        1);
  }
is inconsistent, as not adding a newline before the first argument is typical, as in:
  $ clang-format -style='{BasedOnStyle: google, BinPackArguments: false}' test.cc                                                             ~
  void f() {
    something->Method2s("111111111111111111",
                        "2222222222222222222222222222222222222222222222222222",
                        3);
  }
Repository:
  rC Clang
https://reviews.llvm.org/D52676
    
    
More information about the cfe-commits
mailing list