[clang-format/ObjC] Prohibit breaking after a bracket opening ObjC method expression

Summary:
Don't break after a "[" opening an ObjC method expression.
Tests are added in D48719 where formatting is improved (to avoid adding and changing tests immediately).

Reviewers: benhamilton, klimek

Reviewed By: benhamilton

Subscribers: acoomans, cfe-commits

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

llvm-svn: 336519
This commit is contained in:
Jacek Olesiak 2018-07-09 06:04:58 +00:00
parent 27a5579f15
commit e7c4b5901e
1 changed files with 3 additions and 0 deletions

View File

@ -321,6 +321,9 @@ bool ContinuationIndenter::canBreak(const LineState &State) {
State.Stack.back().NoLineBreakInOperand)
return false;
if (Previous.is(tok::l_square) && Previous.is(TT_ObjCMethodExpr))
return false;
return !State.Stack.back().NoLineBreak;
}