Reduce penalty for breaking before ./-> after complex calls.
This gives a clearer separation of the context, e.g. in GMOCK
statements.
Before:
EXPECT_CALL(SomeObject,
SomeFunction(Parameter)).WillRepeatedly(Return(SomeValue));
After:
EXPECT_CALL(SomeObject, SomeFunction(Parameter))
.WillRepeatedly(Return(SomeValue));
Minor format cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175162 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 22e67df..ace6d25 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -524,11 +524,9 @@
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 @@
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;
}