[PATCH] Store first and last newline position in the token text for string literals and comments.

Daniel Jasper djasper at google.com
Fri Aug 30 04:34:45 PDT 2013



================
Comment at: lib/Format/ContinuationIndenter.cpp:596
@@ -599,2 +595,3 @@
 
+  StringRef FirstLine = Current.TokenText.substr(0, Current.FirstNewlineInText);
   unsigned ColumnsUsed =
----------------
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.


http://llvm-reviews.chandlerc.com/D1556



More information about the cfe-commits mailing list