[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-commits
Subject: [PATCH] D77039: [clang-format] Don't break multi block parameters on ObjCBreakBeforeNestedBlockParam
From: Kanglei Fang via Phabricator via cfe-commits <cfe-commits () lists ! llvm ! org>
Date: 2020-03-31 22:27:26
Message-ID: 48f33a240023719ca62c077c69d90996 () localhost ! localdomain
[Download RAW message or body]
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;
}]
}
["D77039.254015.patch" (text/x-patch)]
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;
}]
}
[Attachment #4 (text/plain)]
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic