diff options
author | Daniel Jasper <djasper@google.com> | 2013-08-30 07:12:40 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-08-30 07:12:40 +0000 |
commit | f8151e9bc1e91432739e8dd86b1c532451b28dc1 (patch) | |
tree | 1b8605c363af9d57b45cc7b047c78857aec21d63 | |
parent | 48a5d69ee18961d4be8bfd37071a50e6a4bee70f (diff) | |
download | bcm5719-llvm-f8151e9bc1e91432739e8dd86b1c532451b28dc1.tar.gz bcm5719-llvm-f8151e9bc1e91432739e8dd86b1c532451b28dc1.zip |
clang-format: Fix corner case in builder-type calls.
Before:
aaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaa()->aaaaaaaaaaaaaae(
0)->aaaaaaaaaaaaaaa();
After:
aaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaa()
->aaaaaaaaaaaaaae(0)
->aaaaaaaaaaaaaaa();
llvm-svn: 189655
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 4 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 718e4a5cdef..10295197240 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -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; } diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index c5e0bcdb55a..eee88889303 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -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) { |