r312542 - [Preprocessor] Correct internal token parsing of newline characters in CRLF

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 5 10:32:36 PDT 2017


Author: erichkeane
Date: Tue Sep  5 10:32:36 2017
New Revision: 312542

URL: http://llvm.org/viewvc/llvm-project?rev=312542&view=rev
Log:
[Preprocessor] Correct internal token parsing of newline characters in CRLF

Correct implementation:  Apparently I managed in r311683 to submit the wrong
version of the patch for this, so I'm correcting it now.

Differential Revision: https://reviews.llvm.org/D37079

Modified:
    cfe/trunk/lib/Lex/Lexer.cpp

Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=312542&r1=312541&r2=312542&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Tue Sep  5 10:32:36 2017
@@ -3071,10 +3071,11 @@ LexNextToken:
     Kind = tok::unknown;
     break;
       
-  case '\n':
   case '\r':
-    if (CurPtr[0] != Char && (CurPtr[0] == '\n' || CurPtr[0] == '\r'))
+    if (CurPtr[0] == '\n')
       Char = getAndAdvanceChar(CurPtr, Result);
+    LLVM_FALLTHROUGH;
+  case '\n':
     // If we are inside a preprocessor directive and we see the end of line,
     // we know we are done with the directive, so return an EOD token.
     if (ParsingPreprocessorDirective) {




More information about the cfe-commits mailing list