diff options
author | Daniel Jasper <djasper@google.com> | 2016-01-04 07:30:44 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2016-01-04 07:30:44 +0000 |
commit | e64d34cacffe012d5982287335cfe2338cb546d7 (patch) | |
tree | f993b3233cb47e5dcb66e26453d0c298edb07e40 /lib/Format/FormatToken.cpp | |
parent | 8dc688335dbc5db7bea08818faeb663b0f18acdf (diff) |
clang-format: Align long braced init lists even if they are nested in
function calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256740 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/FormatToken.cpp')
-rw-r--r-- | lib/Format/FormatToken.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Format/FormatToken.cpp b/lib/Format/FormatToken.cpp index 63af0d6088..d6cd450d89 100644 --- a/lib/Format/FormatToken.cpp +++ b/lib/Format/FormatToken.cpp @@ -218,10 +218,12 @@ void CommaSeparatedList::precomputeFormattingInfos(const FormatToken *Token) { ItemBegin = ItemEnd->Next; } - // Don't use column layout for nested lists, lists with few elements and in - // presence of separating comments. - if ((Token->NestingLevel != 0 && Token->is(tok::l_brace)) || - Commas.size() < 5 || HasSeparatingComment) + // Don't use column layout for lists with few elements and in presence of + // separating comments. + if (Commas.size() < 5 || HasSeparatingComment) + return; + + if (Token->NestingLevel != 0 && Token->is(tok::l_brace) && Commas.size() < 19) return; // We can never place more than ColumnLimit / 3 items in a row (because of the |