forked from OSchip/llvm-project
parent
8cbf633715
commit
86b2dfdc3b
|
@ -174,7 +174,8 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
|
|||
}
|
||||
|
||||
// Same as above, but for the first "<<" operator.
|
||||
if (Current.is(tok::lessless) && State.Stack.back().BreakBeforeParameter &&
|
||||
if (Current.is(tok::lessless) && Current.Type != TT_OverloadedOperator &&
|
||||
State.Stack.back().BreakBeforeParameter &&
|
||||
State.Stack.back().FirstLessLess == 0)
|
||||
return true;
|
||||
|
||||
|
@ -515,7 +516,8 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State,
|
|||
|
||||
if (Current.Type == TT_InheritanceColon)
|
||||
State.Stack.back().AvoidBinPacking = true;
|
||||
if (Current.is(tok::lessless) && State.Stack.back().FirstLessLess == 0)
|
||||
if (Current.is(tok::lessless) && Current.Type != TT_OverloadedOperator &&
|
||||
State.Stack.back().FirstLessLess == 0)
|
||||
State.Stack.back().FirstLessLess = State.Column;
|
||||
if (Current.Type == TT_ArraySubscriptLSquare &&
|
||||
State.Stack.back().StartOfArraySubscripts == 0)
|
||||
|
|
|
@ -3077,6 +3077,11 @@ TEST_F(FormatTest, BreaksFunctionDeclarations) {
|
|||
"operator>(const SomeLoooooooooooooooooooooooooogType &other);");
|
||||
verifyFormat("SomeLoooooooooooooooooooooooooogType\n"
|
||||
"operator>>(const SomeLooooooooooooooooooooooooogType &other);");
|
||||
verifyFormat("SomeLoooooooooooooooooooooooooogType\n"
|
||||
"operator<<(const SomeLooooooooooooooooooooooooogType &other);");
|
||||
verifyGoogleFormat(
|
||||
"SomeLoooooooooooooooooooooooooooooogType operator>>(\n"
|
||||
" const SomeLooooooooogType &a, const SomeLooooooooogType &b);");
|
||||
verifyGoogleFormat(
|
||||
"SomeLoooooooooooooooooooooooooooooogType operator<<(\n"
|
||||
" const SomeLooooooooogType &a, const SomeLooooooooogType &b);");
|
||||
|
|
Loading…
Reference in New Issue