forked from OSchip/llvm-project
clang-format: Fix regression introduced by r291801.
Uncovered by polly tests. Before: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaa, {}, aaaaaaaaaaaaaaaaaaaaaaa); After: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaa, {}, aaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 291807
This commit is contained in:
parent
f02ac0eeb2
commit
e37101076c
|
@ -930,13 +930,6 @@ void ContinuationIndenter::moveStatePastScopeOpener(LineState &State,
|
|||
return;
|
||||
}
|
||||
|
||||
const FormatToken *Previous = Current.getPreviousNonComment();
|
||||
if (Previous && Previous->is(tok::comma) &&
|
||||
!Previous->is(TT_OverloadedOperator)) {
|
||||
if (!Newline)
|
||||
State.Stack.back().NoLineBreak = true;
|
||||
}
|
||||
|
||||
unsigned NewIndent;
|
||||
unsigned NewIndentLevel = State.Stack.back().IndentLevel;
|
||||
unsigned LastSpace = State.Stack.back().LastSpace;
|
||||
|
@ -1010,12 +1003,15 @@ void ContinuationIndenter::moveStatePastScopeOpener(LineState &State,
|
|||
// Generally inherit NoLineBreak from the current scope to nested scope.
|
||||
// However, don't do this for non-empty nested blocks, dict literals and
|
||||
// array literals as these follow different indentation rules.
|
||||
const FormatToken *Previous = Current.getPreviousNonComment();
|
||||
bool NoLineBreak =
|
||||
Current.Children.empty() &&
|
||||
!Current.isOneOf(TT_DictLiteral, TT_ArrayInitializerLSquare) &&
|
||||
(State.Stack.back().NoLineBreak ||
|
||||
(Current.is(TT_TemplateOpener) &&
|
||||
State.Stack.back().ContainsUnwrappedBuilder));
|
||||
State.Stack.back().ContainsUnwrappedBuilder) ||
|
||||
(Current.is(tok::l_brace) && !Newline && Previous &&
|
||||
Previous->is(tok::comma)));
|
||||
State.Stack.push_back(ParenState(NewIndent, NewIndentLevel, LastSpace,
|
||||
AvoidBinPacking, NoLineBreak));
|
||||
State.Stack.back().NestedBlockIndent = NestedBlockIndent;
|
||||
|
|
|
@ -6822,6 +6822,8 @@ TEST_F(FormatTest, FormatsBracedListsInColumnLayout) {
|
|||
" {List1, List2,\n"
|
||||
" List3});",
|
||||
getLLVMStyleWithColumns(35));
|
||||
verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaa, {},\n"
|
||||
" aaaaaaaaaaaaaaaaaaaaaaa);");
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, PullTrivialFunctionDefinitionsIntoSingleLine) {
|
||||
|
|
Loading…
Reference in New Issue