forked from OSchip/llvm-project
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); llvm-svn: 179570
This commit is contained in:
parent
3789171972
commit
1b8e76f14e
|
@ -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 }.
|
||||
|
|
|
@ -1740,6 +1740,12 @@ TEST_F(FormatTest, BreaksFunctionDeclarations) {
|
|||
" Cccccccccccccc cccccccccc, Cccccccccccccc cccccccccc,\n"
|
||||
" Cccccccccccccc cccccccccc, Cccccccccccccc cccccccccc,\n"
|
||||
" Cccccccccccccc cccccccccc, Cccccccccccccc cccccccccc);");
|
||||
|
||||
// Break after multi-line parameters.
|
||||
verifyFormat("void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
|
||||
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
||||
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
|
||||
" bbbb bbbb);");
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, BreaksDesireably) {
|
||||
|
|
Loading…
Reference in New Issue