clang-format: Properly indent method calls without inputs.

Before:
  [aaaaaaaaaaa
          aaaaaaa];

After:
  [aaaaaaaaaaa
      aaaaaaa];

llvm-svn: 236597
This commit is contained in:
Daniel Jasper 2015-05-06 12:48:06 +00:00
parent d35f388b49
commit eb53668c35
2 changed files with 6 additions and 2 deletions

View File

@ -584,10 +584,12 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) {
return State.Stack.back().StartOfArraySubscripts;
return ContinuationIndent;
}
if (NextNonComment->is(TT_StartOfName) && NextNonComment->Next &&
NextNonComment->Next->is(TT_ObjCMethodExpr))
return State.Stack.back().Indent;
if (NextNonComment->isOneOf(TT_StartOfName, TT_PointerOrReference) ||
Previous.isOneOf(tok::coloncolon, tok::equal)) {
Previous.isOneOf(tok::coloncolon, tok::equal))
return ContinuationIndent;
}
if (PreviousNonComment && PreviousNonComment->is(tok::colon) &&
PreviousNonComment->isOneOf(TT_ObjCMethodExpr, TT_DictLiteral))
return ContinuationIndent;

View File

@ -7144,6 +7144,8 @@ TEST_F(FormatTest, FormatObjCMethodExpr) {
" fraction:1.0\n"
" respectFlipped:NO\n"
" hints:nil];");
verifyFormat("[aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa];");
verifyFormat(
"scoped_nsobject<NSTextField> message(\n"