diff options
author | Daniel Jasper <djasper@google.com> | 2013-04-15 22:36:37 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-04-15 22:36:37 +0000 |
commit | 01218ffddc239a71951035d6c7698a11e323efe3 (patch) | |
tree | c4deb3ac781478690ac4f91d178637bc98e690e9 /lib/Format | |
parent | 28117be48de465bc2862a8f4aaab09338be5090b (diff) |
Break after multiline parameters.
We do this in general, but missed a few cases.
Before:
void aaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbb bbbb);
After:
void aaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
bbbb bbbb);
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179570 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format')
-rw-r--r-- | lib/Format/Format.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index c5e1052ce9..a847d4ef9b 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -406,7 +406,9 @@ private: for (unsigned i = 0, e = State.Stack.size() - 1; i != e; ++i) { State.Stack[i].BreakBeforeParameter = true; } - if (Current.isOneOf(tok::period, tok::arrow)) + const AnnotatedToken *TokenBefore = Current.getPreviousNoneComment(); + if (TokenBefore && !TokenBefore->isOneOf(tok::comma, tok::semi) && + !TokenBefore->opensScope()) State.Stack.back().BreakBeforeParameter = true; // If we break after {, we should also break before the corresponding }. |