diff options
Diffstat (limited to 'clang/lib/Format/FormatToken.cpp')
| -rw-r--r-- | clang/lib/Format/FormatToken.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Format/FormatToken.cpp b/clang/lib/Format/FormatToken.cpp index 24a296adc24..e6c72ab0de9 100644 --- a/clang/lib/Format/FormatToken.cpp +++ b/clang/lib/Format/FormatToken.cpp @@ -39,9 +39,13 @@ unsigned CommaSeparatedList::format(LineState &State, LBrace->Next->Type == TT_DesignatedInitializerPeriod) return 0; + // Calculate the number of code points we have to format this list. As the + // first token is already placed, we have to subtract it. + unsigned RemainingCodePoints = Style.ColumnLimit - State.Column + + State.NextToken->Previous->CodePointCount; + // Find the best ColumnFormat, i.e. the best number of columns to use. - unsigned RemainingCharacters = Style.ColumnLimit - State.Stack.back().Indent; - const ColumnFormat *Format = getColumnFormat(RemainingCharacters); + const ColumnFormat *Format = getColumnFormat(RemainingCodePoints); if (!Format) return 0; |

