[PATCH] D33029: [clang-format] add option for dangling parenthesis

2019-06-14 Thread Guillaume Racicot via Phabricator via cfe-commits
gracicot added a comment.

Will this option also work with dangling braces from initializers?

I have some code that looks like this:

  return some_type_with_a_long_name{
  get_param_number_one(),
  get_param_number_two()
  };

Clang format will put the brace at the end of the line:

  return some_type_with_a_long_name{
  get_param_number_one(),
  get_param_number_two()};

I would like to keep the style of the first snippet.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D33029/new/

https://reviews.llvm.org/D33029



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


[PATCH] D109557: Adds a BreakBeforeClosingParen option

2021-10-05 Thread Guillaume Racicot via Phabricator via cfe-commits
gracicot added a comment.

In D109557#3021667 , 
@HazardyKnusperkeks wrote:

> In D109557#3021312 , 
> @MyDeveloperDay wrote:
>
>> FYI, this is a very aggressive change, I highly recommend you run this over 
>> a large code base before landing. to double check, here is one slight oddity 
>> which I cannot determine if its correct or not.
>>
>>   void foo() {
>>   if (quitelongarg != (alsolongarg - 1)) { // ABC is a very 
>> long comment
>> return;
>>   }
>>   }
>>
>> becomes
>>
>>   void foo() {
>> if (quitelongarg != (alsolongarg - 1)
>> ) { // ABC is a very long comment
>>   return;
>> }
>>   }
>>
>>
>>
>>   BasedOnStyle: LLVM
>>   BreakBeforeClosingParen: true
>>
>> That might be what you expect but I wasn't quite sure
>
> That is at least not what is covered in the tests or documentation. I would 
> think it only applies to function declarations and invocations.
> So either adapt documentation and test coverage, or fix behavior (in which 
> case the tests should be extended as well).

I'm waiting for this patch to finally use clang format in our code and we apply 
this style to all braces. This include ifs, for loops, and all control flow.

We use this style specifically in many places in our code:

  if (
 longCondition1
  or longCondition2
  or longCondition3
  ) {
  // code
  }

The you quoted would, in my mind, be formatted like this:

  void foo() {
  if (
  quitelongarg != (alsolongarg - 1)
  ) { // ABC is a very long comment
  return;
  }
  }

This is because I don't allow breaking the closing paren without breaking after 
the opening paren, but this might be only my own style.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109557/new/

https://reviews.llvm.org/D109557

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