[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

llvm-svn: 312542
This commit is contained in:
Erich Keane 2017-09-05 17:32:36 +00:00
parent 1aa667fe64
commit e916d54614
1 changed files with 3 additions and 2 deletions

View File

@ -3071,10 +3071,11 @@ LexNextToken:
Kind = tok::unknown; Kind = tok::unknown;
break; break;
case '\n':
case '\r': case '\r':
if (CurPtr[0] != Char && (CurPtr[0] == '\n' || CurPtr[0] == '\r')) if (CurPtr[0] == '\n')
Char = getAndAdvanceChar(CurPtr, Result); Char = getAndAdvanceChar(CurPtr, Result);
LLVM_FALLTHROUGH;
case '\n':
// If we are inside a preprocessor directive and we see the end of line, // 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. // we know we are done with the directive, so return an EOD token.
if (ParsingPreprocessorDirective) { if (ParsingPreprocessorDirective) {