[PATCH] D31713: [Basic] getColumnNumber returns location of CR+LF on Windows

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 6 02:12:21 PDT 2017


alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

LG with one nit.

Thank you for tracking down this bug and fixing it!



================
Comment at: lib/Basic/SourceManager.cpp:1153
+      if (FilePos + 1 == LineEnd && FilePos > LineStart) {
+        const char *Buf = MemBuf->getBufferStart();
+        if (Buf[FilePos - 1] == '\r' || Buf[FilePos - 1] == '\n')
----------------
I'd move this line before the outermost `if` and remove the identical line below.


Repository:
  rL LLVM

https://reviews.llvm.org/D31713





More information about the cfe-commits mailing list