================
Comment at: lib/Format/ContinuationIndenter.cpp:596
@@ -599,2 +595,3 @@
+ StringRef FirstLine = Current.TokenText.substr(0,
Current.FirstNewlineInText);
unsigned ColumnsUsed =
----------------
Daniel Jasper wrote:
> We never use FirstNewlineInText or LastNewlineInText for anything other than
> getting the substring and then calculating the CodePointCount. Getting the
> CodePointCount again is a linear operation that we do repeatedly while
> finding the best layout. How about precomputing the CodePointCount for both
> values instead.
+1, I also find it more intuitive to have the first and last-line length in the
token.
================
Comment at: lib/Format/ContinuationIndenter.cpp:599
@@ -603,2 +598,3 @@
+ StartColumn + encoding::getCodePointCount(FirstLine, Encoding);
if (ColumnsUsed > getColumnLimit())
return Style.PenaltyExcessCharacter * (ColumnsUsed - getColumnLimit());
----------------
While we're at it - don't we want to take the excess characters of the middle
lines into account? Otherwise, won't we introduce indent levels that push the
middle lines over the limit without noticing?
http://llvm-reviews.chandlerc.com/D1556
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits