Several improvements to the formatting of static initializers.
1. Never avoid bin packing in static initializers as this can
lead to terrible results.
2. If an element has to be broken over multiple lines, break after
the following comma.
This should be a step forward, but there are still many cases
especially with nested static initializers that we handle badly.
More patches will follow.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174061 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index eabc8cf..ecc9b4e 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -206,6 +206,8 @@
}
if (CurrentToken->is(tok::r_paren) || CurrentToken->is(tok::r_square))
return false;
+ if (CurrentToken->is(tok::comma))
+ ++Left->ParameterCount;
if (!consumeToken())
return false;
}