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/BreakableToken.cpp | |
parent | 3767ccf3187e4494e30a7f624d7e8e37eb4527de (diff) | |
download | bcm5719-llvm-39856b71a6e233d9ac8606213c820b17f8f965ea.tar.gz bcm5719-llvm-39856b71a6e233d9ac8606213c820b17f8f965ea.zip |
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/BreakableToken.cpp')
-rw-r--r-- | clang/lib/Format/BreakableToken.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Format/BreakableToken.cpp b/clang/lib/Format/BreakableToken.cpp index 053be4b0252..566769afea5 100644 --- a/clang/lib/Format/BreakableToken.cpp +++ b/clang/lib/Format/BreakableToken.cpp @@ -337,8 +337,10 @@ void BreakableBlockComment::adjustWhitespace(unsigned LineIndex, // if leading tabs are intermixed with spaces, that is not a high priority. // Adjust the start column uniformly accross all lines. - StartOfLineColumn[LineIndex] = - std::max<int>(0, Whitespace.size() + IndentDelta); + StartOfLineColumn[LineIndex] = std::max<int>( + 0, + encoding::columnWidthWithTabs(Whitespace, 0, Style.TabWidth, Encoding) + + IndentDelta); } unsigned BreakableBlockComment::getLineCount() const { return Lines.size(); } |