aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Format/TokenAnnotator.cpp6
-rw-r--r--unittests/Format/FormatTest.cpp2
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 83e1facb21..67ad08a389 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -890,10 +890,10 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
if (Right.is(tok::arrow) || Right.is(tok::period)) {
if (Line.Type == LT_BuilderTypeCall)
- return 5; // Should be smaller than breaking at a nested comma.
+ return 5;
if ((Left.is(tok::r_paren) || Left.is(tok::r_square)) &&
Left.MatchingParen && Left.MatchingParen->ParameterCount > 0)
- return 10;
+ return 20; // Should be smaller than breaking at a nested comma.
return 150;
}
@@ -928,7 +928,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
return prec::Shift;
}
if (Left.Type == TT_ConditionalExpr)
- return prec::Assignment;
+ return prec::Conditional;
prec::Level Level = getPrecedence(Left);
if (Level != prec::Unknown)
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 9e777c66e9..4fe4595574 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -1185,6 +1185,8 @@ TEST_F(FormatTest, BreaksAsHighAsPossible) {
"if ((aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaaaaaaaaa) ||\n"
" (bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb && bbbbbbbbbbbbbbbbbbbbbbbbbb))\n"
" f();");
+ verifyFormat("if (Intervals[i].getRange().getFirst() <\n"
+ " Intervals[i - 1].getRange().getLast()) {\n}");
}
TEST_F(FormatTest, BreaksDesireably) {