summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp2
-rw-r--r--clang/unittests/Format/FormatTest.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index db071f101e4..6135783557e 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1144,7 +1144,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
return 0;
if (Left.is(tok::comma))
return 1;
- if (Right.is(tok::l_square))
+ if (Right.is(tok::l_square) && Right.Type != TT_ObjCMethodExpr)
return 250;
if (Right.Type == TT_StartOfName || Right.is(tok::kw_operator)) {
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index b6c96041469..436a1f6d52b 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -5707,6 +5707,8 @@ TEST_F(FormatTest, FormatObjCMethodExpr) {
verifyFormat("[self // break\n"
" a:a\n"
" aaa:aaa];");
+ verifyFormat("bool a = ([aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaa ||\n"
+ " [aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaaaaa);");
}
TEST_F(FormatTest, ObjCAt) {
OpenPOWER on IntegriCloud