summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/BreakableToken.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-09-10 09:38:25 +0000
committerAlexander Kornienko <alexfh@google.com>2013-09-10 09:38:25 +0000
commit39856b71a6e233d9ac8606213c820b17f8f965ea (patch)
treeda171e82ae8eea20bb119afa9b93d204178bf3ae /clang/lib/Format/BreakableToken.cpp
parent3767ccf3187e4494e30a7f624d7e8e37eb4527de (diff)
downloadbcm5719-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.cpp6
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(); }
OpenPOWER on IntegriCloud