There’s an existing test in r311683. I’d initially implemented handling ‘\r\n’ as well as ‘\n\r’, but Reid had suggested that I simply handle the former. I’d inadvertently contributed the previous revision. I noticed this morning that I’d done so, so I corrected my commit.
From: tha...@google.com [mailto:tha...@google.com] On Behalf Of Nico Weber Sent: Tuesday, September 5, 2017 1:47 PM To: Keane, Erich <erich.ke...@intel.com> Cc: cfe-commits <cfe-commits@lists.llvm.org> Subject: Re: r312542 - [Preprocessor] Correct internal token parsing of newline characters in CRLF Test? On Tue, Sep 5, 2017 at 1:32 PM, Erich Keane via cfe-commits <cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org>> wrote: 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) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org<mailto:cfe-commits@lists.llvm.org> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits