[PATCH] Add CRLF support to LineIterator.

Chandler Carruth chandlerc at gmail.com
Sat Nov 1 18:55:43 PDT 2014


So, I'm OK with this... but I wonder what it does to the performance of the line iterator. Hopefully we never care.

I've made a minor suggestion below that should at least make one of the cases quite a bit simpler.

================
Comment at: lib/Support/LineIterator.cpp:64-65
@@ -44,6 +63,4 @@
     // If we're not stripping comments, this is simpler.
-    size_t Blanks = 0;
-    while (Pos[Blanks] == '\n')
-      ++Blanks;
-    Pos += Blanks;
-    LineNumber += Blanks;
+    while (isAtLineEnd(Pos)) {
+      skipLineEnd(Pos);
+      ++LineNumber;
----------------
This suggests that skipLineEnd should return whether it did indeed skip a line end?

http://reviews.llvm.org/D5844






More information about the llvm-commits mailing list