diff options
author | Daniel Jasper <djasper@google.com> | 2014-04-17 11:32:02 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-04-17 11:32:02 +0000 |
commit | 343f33f4e7ea44c8c55024c65c4af0abd2c50956 (patch) | |
tree | 4a1c6e30583e456e820dc4cb338cd5277a424a42 /lib/Format/FormatToken.cpp | |
parent | 594e55be0ecb4c1dff6dea9762c5b2f36d7bb0a2 (diff) |
clang-format: Respect BinPackParameters in Cpp11BracedListStyle.
With BinPackParameters=false and Cpp11BracedListStyle=true (i.e. mostly
for Chromium):
Before:
const Aaaaaa aaaaa = {aaaaa, bbbbb, ccccc, ddddd, eeeee, ffffff,
ggggg, hhhhhh, iiiiii, jjjjjj, kkkkkk};
After:
const Aaaaaa aaaaa = {aaaaa,
bbbbb,
ccccc,
ddddd,
eeeee,
ffffff,
ggggg,
hhhhhh,
iiiiii,
jjjjjj,
kkkkkk};
This fixes llvm.org/PR19359. I am not sure we'll want this in all cases
in the long run, but I'll guess we'll get feedback on that.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206458 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/FormatToken.cpp')
-rw-r--r-- | lib/Format/FormatToken.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Format/FormatToken.cpp b/lib/Format/FormatToken.cpp index c147dbb6b1..a7c003bc18 100644 --- a/lib/Format/FormatToken.cpp +++ b/lib/Format/FormatToken.cpp @@ -132,6 +132,11 @@ void CommaSeparatedList::precomputeFormattingInfos(const FormatToken *Token) { 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) + return; + FormatToken *ItemBegin = Token->Next; SmallVector<bool, 8> MustBreakBeforeItem; |