[PATCH] D109557: Adds a BreakBeforeClosingParen option
Guillaume Racicot via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 5 12:23:45 PDT 2021
gracicot added a comment.
In D109557#3021667 <https://reviews.llvm.org/D109557#3021667>, @HazardyKnusperkeks wrote:
> In D109557#3021312 <https://reviews.llvm.org/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 longgggggggggggg comment
>> return;
>> }
>> }
>>
>> becomes
>>
>> void foo() {
>> if (quitelongarg != (alsolongarg - 1)
>> ) { // ABC is a very longgggggggggggg 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 longgggggggggggg 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
More information about the cfe-commits
mailing list