forked from OSchip/llvm-project
clang-format: Correctly apply wrap before multi-line RHS rule to
ternary expressions. Before: return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ? aaaaa : bbbbbbbbbbbbbbb + cccccccccccccccc; After: return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ? aaaaa : bbbbbbbbbbbbbbb + cccccccccccccccc; llvm-svn: 262293
This commit is contained in:
parent
f9168de892
commit
04b4e10873
|
@ -847,7 +847,7 @@ void ContinuationIndenter::moveStatePastFakeLParens(LineState &State,
|
||||||
// there is a line-break right after the operator.
|
// there is a line-break right after the operator.
|
||||||
// Exclude relational operators, as there, it is always more desirable to
|
// Exclude relational operators, as there, it is always more desirable to
|
||||||
// have the LHS 'left' of the RHS.
|
// have the LHS 'left' of the RHS.
|
||||||
if (Previous && Previous->getPrecedence() > prec::Assignment &&
|
if (Previous && Previous->getPrecedence() != prec::Assignment &&
|
||||||
Previous->isOneOf(TT_BinaryOperator, TT_ConditionalExpr) &&
|
Previous->isOneOf(TT_BinaryOperator, TT_ConditionalExpr) &&
|
||||||
Previous->getPrecedence() != prec::Relational) {
|
Previous->getPrecedence() != prec::Relational) {
|
||||||
bool BreakBeforeOperator =
|
bool BreakBeforeOperator =
|
||||||
|
|
|
@ -4708,6 +4708,10 @@ TEST_F(FormatTest, BreaksConditionalExpressionsAfterOperator) {
|
||||||
" /*bbbbbbbbbbbbbbb=*/bbbbbbbbbbbbbbbbbbbbbbbbb :\n"
|
" /*bbbbbbbbbbbbbbb=*/bbbbbbbbbbbbbbbbbbbbbbbbb :\n"
|
||||||
" ccccccccccccccccccccccccccc;",
|
" ccccccccccccccccccccccccccc;",
|
||||||
Style);
|
Style);
|
||||||
|
verifyFormat("return aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ?\n"
|
||||||
|
" aaaaa :\n"
|
||||||
|
" bbbbbbbbbbbbbbb + cccccccccccccccc;",
|
||||||
|
Style);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, DeclarationsOfMultipleVariables) {
|
TEST_F(FormatTest, DeclarationsOfMultipleVariables) {
|
||||||
|
|
Loading…
Reference in New Issue