[PATCH] Calculate and store ColumnWidth instead of CodePointCount in FormatTokens.
Daniel Jasper
djasper at google.com
Tue Sep 10 00:46:03 PDT 2013
Nice. Thank you!
================
Comment at: lib/Format/Format.cpp:687
@@ -686,20 +686,3 @@
- // Now FormatTok is the next non-whitespace token.
- FormatTok->CodePointCount =
- encoding::getCodePointCount(FormatTok->TokenText, Encoding);
-
- if (FormatTok->isOneOf(tok::string_literal, tok::comment)) {
- StringRef Text = FormatTok->TokenText;
- size_t FirstNewlinePos = Text.find('\n');
- if (FirstNewlinePos != StringRef::npos) {
- // FIXME: Handle embedded tabs.
- FormatTok->FirstLineColumnWidth = encoding::columnWidthWithTabs(
- Text.substr(0, FirstNewlinePos), 0, Style.TabWidth, Encoding);
- FormatTok->LastLineColumnWidth = encoding::columnWidthWithTabs(
- Text.substr(Text.find_last_of('\n') + 1), 0, Style.TabWidth,
- Encoding);
- }
- }
- // FIXME: Add the CodePointCount to Column.
FormatTok->WhitespaceRange = SourceRange(
WhitespaceStart, WhitespaceStart.getLocWithOffset(WhitespaceLength));
----------------
Any particular reason to move this?
================
Comment at: lib/Format/Format.cpp:689
@@ -705,1 +688,3 @@
WhitespaceStart, WhitespaceStart.getLocWithOffset(WhitespaceLength));
+ // Now FormatTok is the next non-whitespace token.
+
----------------
It looks slightly weird to me to have a line comment with no empty line before but an empty line afterwards. Is this intentional?
http://llvm-reviews.chandlerc.com/D1608
BRANCH
svn
ARCANIST PROJECT
clang
More information about the cfe-commits
mailing list