[PATCH] D146042: [clang-format] Fix numerous issues with "LambdaBodyIndentation: OuterScope" option

Jon Phillips via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 4 12:53:34 PDT 2023


jp4a50 marked 2 inline comments as done.
jp4a50 added a comment.

In D146042#4239182 <https://reviews.llvm.org/D146042#4239182>, @owenpan wrote:

> In D146042#4204651 <https://reviews.llvm.org/D146042#4204651>, @jp4a50 wrote:
>
>> I'm confident that the patch will indent all those examples correctly when they are at block scope which is the only place those snippets will actually be valid code. I added an exception (see comment in ContinuationIndenter.cpp) to the code to disable `OuterScope`'s behaviour when the line's indentation level is 0 (i.e. statements at namespace scope) because otherwise you can end up with things like:
>>
>>   Namespace::Foo::Foo(
>>     Arg arg1, Arg arg2,
>>     Arg arg3, Arg arg4)
>>     : init1{arg1},
>>       init2{[arg2]() {
>>     return arg2;
>>   }},
>>       init3{arg3},
>>       init4{arg4} {}
>
> Sorry that I missed it.

NP - as I say, I've removed this special casing for now since it is controversial to include it in a patch claiming to simply fix bugs.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146042



More information about the cfe-commits mailing list