소스 검색

[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
Jacek Olesiak 7 년 전
부모
커밋
1e3b4b4fba
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      lib/Format/ContinuationIndenter.cpp

+ 3 - 0
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;
 }