forked from OSchip/llvm-project
clang-format: Fix incorrect line break in certain configurations.
Before: void aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa, vector<int> bbbbbbbbbbbbbbb); After: void aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa, vector<int> bbbbbbbbbbbbbbb); llvm-svn: 257257
This commit is contained in:
parent
804a276fcf
commit
00693b08cf
|
@ -150,7 +150,8 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
|
||||||
if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection)
|
if (Previous.is(tok::semi) && State.LineContainsContinuedForLoopSection)
|
||||||
return true;
|
return true;
|
||||||
if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) ||
|
if ((startsNextParameter(Current, Style) || Previous.is(tok::semi) ||
|
||||||
(Previous.is(TT_TemplateCloser) && Current.is(TT_StartOfName)) ||
|
(Previous.is(TT_TemplateCloser) && Current.is(TT_StartOfName) &&
|
||||||
|
Previous.NestingLevel == 1) ||
|
||||||
(Style.BreakBeforeTernaryOperators && Current.is(TT_ConditionalExpr) &&
|
(Style.BreakBeforeTernaryOperators && Current.is(TT_ConditionalExpr) &&
|
||||||
Previous.isNot(tok::question)) ||
|
Previous.isNot(tok::question)) ||
|
||||||
(!Style.BreakBeforeTernaryOperators &&
|
(!Style.BreakBeforeTernaryOperators &&
|
||||||
|
|
|
@ -4062,6 +4062,10 @@ TEST_F(FormatTest, FormatsDeclarationsOnePerLine) {
|
||||||
" int aaaaaaaaaaaaaaaaaaaa,\n"
|
" int aaaaaaaaaaaaaaaaaaaa,\n"
|
||||||
" int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}",
|
" int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}",
|
||||||
NoBinPacking);
|
NoBinPacking);
|
||||||
|
NoBinPacking.AllowAllParametersOfDeclarationOnNextLine = false;
|
||||||
|
verifyFormat("void aaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
|
||||||
|
" vector<int> bbbbbbbbbbbbbbb);",
|
||||||
|
NoBinPacking);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, FormatsOneParameterPerLineIfNecessary) {
|
TEST_F(FormatTest, FormatsOneParameterPerLineIfNecessary) {
|
||||||
|
|
Loading…
Reference in New Issue