From: Jacek Olesiak Date: Mon, 9 Jul 2018 06:04:58 +0000 (+0000) Subject: [clang-format/ObjC] Prohibit breaking after a bracket opening ObjC method expression X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e3b4b4fba6dcc8af4df69add4180e9e047f76e0;p=clang [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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336519 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/ContinuationIndenter.cpp b/lib/Format/ContinuationIndenter.cpp index bb8efd61a3..0862a4e0f9 100644 --- a/lib/Format/ContinuationIndenter.cpp +++ b/lib/Format/ContinuationIndenter.cpp @@ -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; }