Author: jolesiak Date: Sun Jul 8 23:04:58 2018 New Revision: 336519 URL: http://llvm.org/viewvc/llvm-project?rev=336519&view=rev Log: [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 Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=336519&r1=336518&r2=336519&view=diff ============================================================================== --- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original) +++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Sun Jul 8 23:04:58 2018 @@ -321,6 +321,9 @@ bool ContinuationIndenter::canBreak(cons State.Stack.back().NoLineBreakInOperand) return false; + if (Previous.is(tok::l_square) && Previous.is(TT_ObjCMethodExpr)) + return false; + return !State.Stack.back().NoLineBreak; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits