forked from OSchip/llvm-project
clang-format: Fix ObjC method expr in binary expressions.
Before: bool a = ([aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaa || [aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaaaaa); After: bool a = ([aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaa || [aaaaaaaa aaaaa] == aaaaaaaaaaaaaaaaaaaa); This fixes llvm.org/PR18271. llvm-svn: 197552
This commit is contained in:
parent
53eaea0104
commit
3460b2546c
|
@ -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)) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue