diff options
Diffstat (limited to 'lib/Format/TokenAnnotator.cpp')
-rw-r--r-- | lib/Format/TokenAnnotator.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 22e67df1ec..ace6d25467 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -524,11 +524,9 @@ private: struct ScopedContextCreator { AnnotatingParser &P; - ScopedContextCreator(AnnotatingParser &P, unsigned Increase) - : P(P) { - P.Contexts.push_back(Context( - P.Contexts.back().BindingStrength + Increase, - P.Contexts.back().IsExpression)); + ScopedContextCreator(AnnotatingParser &P, unsigned Increase) : P(P) { + P.Contexts.push_back(Context(P.Contexts.back().BindingStrength + Increase, + P.Contexts.back().IsExpression)); } ~ScopedContextCreator() { P.Contexts.pop_back(); } @@ -865,6 +863,9 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line, if (Right.is(tok::arrow) || Right.is(tok::period)) { if (Left.is(tok::r_paren) && Line.Type == LT_BuilderTypeCall) return 5; // Should be smaller than breaking at a nested comma. + if ((Left.is(tok::r_paren) || Left.is(tok::r_square)) && + Left.MatchingParen && Left.MatchingParen->ParameterCount > 0) + return 10; return 150; } |