[PATCH] D77039: [clang-format] Don't break multi block parameters on ObjCBreakBeforeNestedBlockParam

2020-04-07 Thread Kanglei Fang via Phabricator via cfe-commits
ghvg1313 added a comment.

In D77039#1967224 , @MyDeveloperDay 
wrote:

> what is changing in clang/docs/ClangFormatStyleOptions.rst? if nothing then 
> remove from the diff


there's an indentation issue, this changes the example of the doc from:

  - (void)_aMethod
   {
  [self.test1 t:self
   w:self
  callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
  u = c;
   }]
  }

to

  - (void)_aMethod
  {
 [self.test1 t:self
 w:self
  callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
  u = c;
  }]
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77039



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


[PATCH] D77039: [clang-format] Don't break multi block parameters on ObjCBreakBeforeNestedBlockParam

2020-04-07 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment.

what is changing in clang/docs/ClangFormatStyleOptions.rst? if nothing then 
remove from the diff


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77039



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


[PATCH] D77039: [clang-format] Don't break multi block parameters on ObjCBreakBeforeNestedBlockParam

2020-04-06 Thread Jin Lin via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG28ecd7f0b086: [clang-format] Dont break multi block 
parameters on… (authored by ghvg1313, committed by jinlin).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77039

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/lib/Format/ContinuationIndenter.cpp
  clang/unittests/Format/FormatTestObjC.cpp


Index: clang/unittests/Format/FormatTestObjC.cpp
===
--- clang/unittests/Format/FormatTestObjC.cpp
+++ clang/unittests/Format/FormatTestObjC.cpp
@@ -1420,6 +1420,10 @@
"*b, NSNumber *c) {\n"
"  b = c;\n"
"}]");
+  verifyFormat("[self.test1 t:self w:self callback:^(typeof(self) self, "
+   "NSNumber *u, NSNumber *v) {\n"
+   "  u = v;\n"
+   "} z:self]");
 
   Style.ColumnLimit = 80;
   verifyFormat(
Index: clang/lib/Format/ContinuationIndenter.cpp
===
--- clang/lib/Format/ContinuationIndenter.cpp
+++ clang/lib/Format/ContinuationIndenter.cpp
@@ -342,6 +342,7 @@
   if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection)
 return true;
   if (Style.Language == FormatStyle::LK_ObjC &&
+  Style.ObjCBreakBeforeNestedBlockParam &&
   Current.ObjCSelectorNameParts > 1 &&
   Current.startsSequence(TT_SelectorName, tok::colon, tok::caret)) {
 return true;
Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -2072,8 +2072,8 @@
  - (void)_aMethod
  {
 [self.test1 t:self
- w:self
-callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
+w:self
+ callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
  u = c;
  }]
  }


Index: clang/unittests/Format/FormatTestObjC.cpp
===
--- clang/unittests/Format/FormatTestObjC.cpp
+++ clang/unittests/Format/FormatTestObjC.cpp
@@ -1420,6 +1420,10 @@
"*b, NSNumber *c) {\n"
"  b = c;\n"
"}]");
+  verifyFormat("[self.test1 t:self w:self callback:^(typeof(self) self, "
+   "NSNumber *u, NSNumber *v) {\n"
+   "  u = v;\n"
+   "} z:self]");
 
   Style.ColumnLimit = 80;
   verifyFormat(
Index: clang/lib/Format/ContinuationIndenter.cpp
===
--- clang/lib/Format/ContinuationIndenter.cpp
+++ clang/lib/Format/ContinuationIndenter.cpp
@@ -342,6 +342,7 @@
   if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection)
 return true;
   if (Style.Language == FormatStyle::LK_ObjC &&
+  Style.ObjCBreakBeforeNestedBlockParam &&
   Current.ObjCSelectorNameParts > 1 &&
   Current.startsSequence(TT_SelectorName, tok::colon, tok::caret)) {
 return true;
Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -2072,8 +2072,8 @@
  - (void)_aMethod
  {
 [self.test1 t:self
- w:self
-callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
+w:self
+ callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
  u = c;
  }]
  }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77039: [clang-format] Don't break multi block parameters on ObjCBreakBeforeNestedBlockParam

2020-03-31 Thread Kanglei Fang via Phabricator via cfe-commits
ghvg1313 added a comment.

@jolesiak I don't yet have the commit access, do you mind help merging this 
diff? Thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77039



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


[PATCH] D77039: [clang-format] Don't break multi block parameters on ObjCBreakBeforeNestedBlockParam

2020-03-31 Thread Kanglei Fang via Phabricator via cfe-commits
ghvg1313 updated this revision to Diff 254015.
ghvg1313 added a comment.

reset diff's base


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77039

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/lib/Format/ContinuationIndenter.cpp
  clang/unittests/Format/FormatTestObjC.cpp


Index: clang/unittests/Format/FormatTestObjC.cpp
===
--- clang/unittests/Format/FormatTestObjC.cpp
+++ clang/unittests/Format/FormatTestObjC.cpp
@@ -1420,6 +1420,10 @@
"*b, NSNumber *c) {\n"
"  b = c;\n"
"}]");
+  verifyFormat("[self.test1 t:self w:self callback:^(typeof(self) self, "
+   "NSNumber *u, NSNumber *v) {\n"
+   "  u = v;\n"
+   "} z:self]");
 
   Style.ColumnLimit = 80;
   verifyFormat(
Index: clang/lib/Format/ContinuationIndenter.cpp
===
--- clang/lib/Format/ContinuationIndenter.cpp
+++ clang/lib/Format/ContinuationIndenter.cpp
@@ -342,6 +342,7 @@
   if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection)
 return true;
   if (Style.Language == FormatStyle::LK_ObjC &&
+  Style.ObjCBreakBeforeNestedBlockParam &&
   Current.ObjCSelectorNameParts > 1 &&
   Current.startsSequence(TT_SelectorName, tok::colon, tok::caret)) {
 return true;
Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -2072,8 +2072,8 @@
  - (void)_aMethod
  {
 [self.test1 t:self
- w:self
-callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
+w:self
+ callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
  u = c;
  }]
  }


Index: clang/unittests/Format/FormatTestObjC.cpp
===
--- clang/unittests/Format/FormatTestObjC.cpp
+++ clang/unittests/Format/FormatTestObjC.cpp
@@ -1420,6 +1420,10 @@
"*b, NSNumber *c) {\n"
"  b = c;\n"
"}]");
+  verifyFormat("[self.test1 t:self w:self callback:^(typeof(self) self, "
+   "NSNumber *u, NSNumber *v) {\n"
+   "  u = v;\n"
+   "} z:self]");
 
   Style.ColumnLimit = 80;
   verifyFormat(
Index: clang/lib/Format/ContinuationIndenter.cpp
===
--- clang/lib/Format/ContinuationIndenter.cpp
+++ clang/lib/Format/ContinuationIndenter.cpp
@@ -342,6 +342,7 @@
   if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection)
 return true;
   if (Style.Language == FormatStyle::LK_ObjC &&
+  Style.ObjCBreakBeforeNestedBlockParam &&
   Current.ObjCSelectorNameParts > 1 &&
   Current.startsSequence(TT_SelectorName, tok::colon, tok::caret)) {
 return true;
Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -2072,8 +2072,8 @@
  - (void)_aMethod
  {
 [self.test1 t:self
- w:self
-callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
+w:self
+ callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
  u = c;
  }]
  }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77039: [clang-format] Don't break multi block parameters on ObjCBreakBeforeNestedBlockParam

2020-03-31 Thread Kanglei Fang via Phabricator via cfe-commits
ghvg1313 updated this revision to Diff 254014.
ghvg1313 added a comment.

- Fix documentation formatting


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77039

Files:
  clang/docs/ClangFormatStyleOptions.rst


Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -2072,8 +2072,8 @@
  - (void)_aMethod
  {
 [self.test1 t:self
- w:self
-callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
+w:self
+ callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
  u = c;
  }]
  }


Index: clang/docs/ClangFormatStyleOptions.rst
===
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -2072,8 +2072,8 @@
  - (void)_aMethod
  {
 [self.test1 t:self
- w:self
-callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
+w:self
+ callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
  u = c;
  }]
  }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D77039: [clang-format] Don't break multi block parameters on ObjCBreakBeforeNestedBlockParam

2020-03-31 Thread Jacek Olesiak via Phabricator via cfe-commits
jolesiak accepted this revision.
jolesiak added a comment.
This revision is now accepted and ready to land.

Makes sense, thanks for patching this!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77039



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


[PATCH] D77039: [clang-format] Don't break multi block parameters on ObjCBreakBeforeNestedBlockParam

2020-03-30 Thread Kanglei Fang via Phabricator via cfe-commits
ghvg1313 created this revision.
ghvg1313 added reviewers: jolesiak, benhamilton.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

While the original diff  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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77039

Files:
  clang/lib/Format/ContinuationIndenter.cpp
  clang/unittests/Format/FormatTestObjC.cpp


Index: clang/unittests/Format/FormatTestObjC.cpp
===
--- clang/unittests/Format/FormatTestObjC.cpp
+++ clang/unittests/Format/FormatTestObjC.cpp
@@ -1420,6 +1420,10 @@
"*b, NSNumber *c) {\n"
"  b = c;\n"
"}]");
+  verifyFormat("[self.test1 t:self w:self callback:^(typeof(self) self, "
+   "NSNumber *u, NSNumber *v) {\n"
+   "  u = v;\n"
+   "} z:self]");
 
   Style.ColumnLimit = 80;
   verifyFormat(
Index: clang/lib/Format/ContinuationIndenter.cpp
===
--- clang/lib/Format/ContinuationIndenter.cpp
+++ clang/lib/Format/ContinuationIndenter.cpp
@@ -342,6 +342,7 @@
   if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection)
 return true;
   if (Style.Language == FormatStyle::LK_ObjC &&
+  Style.ObjCBreakBeforeNestedBlockParam &&
   Current.ObjCSelectorNameParts > 1 &&
   Current.startsSequence(TT_SelectorName, tok::colon, tok::caret)) {
 return true;


Index: clang/unittests/Format/FormatTestObjC.cpp
===
--- clang/unittests/Format/FormatTestObjC.cpp
+++ clang/unittests/Format/FormatTestObjC.cpp
@@ -1420,6 +1420,10 @@
"*b, NSNumber *c) {\n"
"  b = c;\n"
"}]");
+  verifyFormat("[self.test1 t:self w:self callback:^(typeof(self) self, "
+   "NSNumber *u, NSNumber *v) {\n"
+   "  u = v;\n"
+   "} z:self]");
 
   Style.ColumnLimit = 80;
   verifyFormat(
Index: clang/lib/Format/ContinuationIndenter.cpp
===
--- clang/lib/Format/ContinuationIndenter.cpp
+++ clang/lib/Format/ContinuationIndenter.cpp
@@ -342,6 +342,7 @@
   if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection)
 return true;
   if (Style.Language == FormatStyle::LK_ObjC &&
+  Style.ObjCBreakBeforeNestedBlockParam &&
   Current.ObjCSelectorNameParts > 1 &&
   Current.startsSequence(TT_SelectorName, tok::colon, tok::caret)) {
 return true;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits