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 | 39856b71a6e233d9ac8606213c820b17f8f965ea (patch) | |
tree | da171e82ae8eea20bb119afa9b93d204178bf3ae /clang/lib/Format/FormatToken.cpp | |
parent | 3767ccf3187e4494e30a7f624d7e8e37eb4527de (diff) | |
download | llvm-39856b71a6e233d9ac8606213c820b17f8f965ea.zip llvm-39856b71a6e233d9ac8606213c820b17f8f965ea.tar.gz llvm-39856b71a6e233d9ac8606213c820b17f8f965ea.tar.bz2 |
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
llvm-svn: 190395
Diffstat (limited to 'clang/lib/Format/FormatToken.cpp')
-rw-r--r-- | clang/lib/Format/FormatToken.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Format/FormatToken.cpp b/clang/lib/Format/FormatToken.cpp index e6c72ab..49e0ce8 100644 --- a/clang/lib/Format/FormatToken.cpp +++ b/clang/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) { |