diff options
author | Alexander Kornienko <alexfh@google.com> | 2013-09-10 09:38:25 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2013-09-10 09:38:25 +0000 |
commit | 83a7dcdf5fce1bdf74ce985419d77a41a51abfa2 (patch) | |
tree | 4247d1859bca0c2aae0a14ca4491d32b880fe5d2 /lib/Format/FormatToken.cpp | |
parent | 3f46e6f45907b7004e2c8dfec1a84877d6d262d6 (diff) |
Calculate and store ColumnWidth instead of CodePointCount in FormatTokens.
Summary:
This fixes various issues with mixed tabs and spaces handling, e.g.
when realigning block comments.
Reviewers: klimek, djasper
Reviewed By: djasper
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1608
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190395 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/FormatToken.cpp')
-rw-r--r-- | lib/Format/FormatToken.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Format/FormatToken.cpp b/lib/Format/FormatToken.cpp index e6c72ab0de..49e0ce8337 100644 --- a/lib/Format/FormatToken.cpp +++ b/lib/Format/FormatToken.cpp @@ -42,7 +42,7 @@ unsigned CommaSeparatedList::format(LineState &State, // 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; + State.NextToken->Previous->ColumnWidth; // Find the best ColumnFormat, i.e. the best number of columns to use. const ColumnFormat *Format = getColumnFormat(RemainingCodePoints); @@ -82,7 +82,7 @@ unsigned CommaSeparatedList::format(LineState &State, static unsigned CodePointsBetween(const FormatToken *Begin, const FormatToken *End) { assert(End->TotalLength >= Begin->TotalLength); - return End->TotalLength - Begin->TotalLength + Begin->CodePointCount; + return End->TotalLength - Begin->TotalLength + Begin->ColumnWidth; } void CommaSeparatedList::precomputeFormattingInfos(const FormatToken *Token) { |