Selaa lähdekoodia

[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 vuotta sitten
vanhempi
commit
1e3b4b4fba
1 muutettua tiedostoa jossa 3 lisäystä ja 0 poistoa
  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)
       State.Stack.back().NoLineBreakInOperand)
     return false;
     return false;
 
 
+  if (Previous.is(tok::l_square) && Previous.is(TT_ObjCMethodExpr))
+    return false;
+
   return !State.Stack.back().NoLineBreak;
   return !State.Stack.back().NoLineBreak;
 }
 }