Skip to content

Commit

Permalink
[clang-format/ObjC] Prohibit breaking after a bracket opening ObjC me…
Browse files Browse the repository at this point in the history
…thod 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
  • Loading branch information
Jacek Olesiak committed Jul 9, 2018
1 parent 27a5579 commit e7c4b59
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/lib/Format/ContinuationIndenter.cpp
Expand Up @@ -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;
}

Expand Down

0 comments on commit e7c4b59

Please sign in to comment.