oleg.smolsky added a comment.

In https://reviews.llvm.org/D52676#1250071, @krasimir wrote:

> 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.


Hmm... perhaps. I have not been able to find an explicit rule for that.

>> 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);
>   }

Right, it's consistent with your example but inconsistent with with the 
following two:

lambda at arg0:

  void f() {
    something->Method2s(
        [this] {
          Do1();
          Do2();
        },
        1);
  }

and two lambdas:

  // Multiple lambdas in the same parentheses change indentation rules.
  verifyFormat("SomeFunction(\n"
               "    []() {\n"
               "      int i = 42;\n"
               "      return i;\n"
               "    },\n"
               "    []() {\n"
               "      int j = 43;\n"
               "      return j;\n"
               "    });");


Repository:
  rC Clang

https://reviews.llvm.org/D52676



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to