clang-format: Fix corner case in builder-type calls.

Before:
  aaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaa()->aaaaaaaaaaaaaae(
                                                 0)->aaaaaaaaaaaaaaa();

After:
  aaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaa()
      ->aaaaaaaaaaaaaae(0)
      ->aaaaaaaaaaaaaaa();

llvm-svn: 189655
This commit is contained in:
Daniel Jasper 2013-08-30 07:12:40 +00:00
parent 48a5d69ee1
commit f8151e9bc1
2 changed files with 6 additions and 1 deletions

View File

@ -187,7 +187,9 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
State.ParenLevel == 0)
return true;
if (startsSegmentOfBuilderTypeCall(Current) &&
State.Stack.back().CallContinuation != 0)
(State.Stack.back().CallContinuation != 0 ||
(State.Stack.back().BreakBeforeParameter &&
State.Stack.back().ContainsUnwrappedBuilder)))
return true;
return false;
}

View File

@ -2890,6 +2890,9 @@ TEST_F(FormatTest, FormatsBuilderPattern) {
verifyFormat("aaaaaaaaaaaaaaa.aaaaaaaaaaaaaaa()\n"
" .aaaaaaaaaaaaaaa.aaaaaaaaaaaaaaa()\n"
" .aaaaaaaaaaaaaaa();");
verifyFormat("aaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaa()\n"
" ->aaaaaaaaaaaaaae(0)\n"
" ->aaaaaaaaaaaaaaa();");
}
TEST_F(FormatTest, BreaksAccordingToOperatorPrecedence) {