[all-commits] [llvm/llvm-project] 28ecd7: [clang-format] Don't break multi block parameters ...

Kanglei Fang via All-commits all-commits at lists.llvm.org
Mon Apr 6 14:20:23 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 28ecd7f0b0865878a12d814a6d0de92cb7529d22
      https://github.com/llvm/llvm-project/commit/28ecd7f0b0865878a12d814a6d0de92cb7529d22
  Author: Kanglei Fang <kanglei at uber.com>
  Date:   2020-04-06 (Mon, 06 Apr 2020)

  Changed paths:
    M clang/docs/ClangFormatStyleOptions.rst
    M clang/lib/Format/ContinuationIndenter.cpp
    M clang/unittests/Format/FormatTestObjC.cpp

  Log Message:
  -----------
  [clang-format] Don't break multi block parameters on ObjCBreakBeforeNestedBlockParam

Summary:
While [the original diff](https://reviews.llvm.org/D42493) makes a lot of sense, and multiple inline block parameter/trailing paramemter after inline block paramemter should be discouraged, the formatting result is different than what xcode does by default
For the exact same example provided in the original diff:
```
[object
  blockArgument:^{
    a = 42;
  }
     anotherArg:42];
```
The code is hard to read and not very visually pleasing

This diff uses `ObjCBreakBeforeNestedBlockParam` to shield from the formatting
When it's set to false, don't allign the inline block paramemters.

Reviewers: jolesiak, benhamilton, jinlin

Reviewed By: jolesiak

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77039




More information about the All-commits mailing list