After (even with BinPacking = false):
const Aaaaaa aaaaa = {
aaaaa, bbbbb, ccccc, ddddd, eeeee, ffffff, ggggg, hhhhhh,
iiiiii, jjjjjj, kkkkkk, aaaaa, bbbbb, ccccc, ddddd, eeeee,
ffffff, ggggg, hhhhhh, iiiiii, jjjjjj, kkkkkk,
};
Before:
<each element on its own line>
This fixes http://llvm.org/PR20623.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215529
91177308-0d34-0410-b5e6-
96231b3b80d8
if (!Token->MatchingParen || Token->isNot(tok::l_brace))
return;
- // In C++11 braced list style, we should not format in columns unless we allow
- // bin-packing of function parameters.
- if (Style.Cpp11BracedListStyle && !Style.BinPackParameters)
+ // In C++11 braced list style, we should not format in columns unless they
+ // have many items (20 or more) or we allow bin-packing of function
+ // parameters.
+ if (Style.Cpp11BracedListStyle && !Style.BinPackParameters &&
+ Commas.size() < 19)
return;
FormatToken *ItemBegin = Token->Next;
" kkkkkk,\n"
"};",
NoBinPacking);
+ verifyFormat(
+ "const Aaaaaa aaaaa = {\n"
+ " aaaaa, bbbbb, ccccc, ddddd, eeeee, ffffff, ggggg, hhhhhh,\n"
+ " iiiiii, jjjjjj, kkkkkk, aaaaa, bbbbb, ccccc, ddddd, eeeee,\n"
+ " ffffff, ggggg, hhhhhh, iiiiii, jjjjjj, kkkkkk,\n"
+ "};",
+ NoBinPacking);
// FIXME: The alignment of these trailing comments might be bad. Then again,
// this might be utterly useless in real code.