Skip to content

Commit

Permalink
[Preprocessor] Correct internal token parsing of newline characters i…
Browse files Browse the repository at this point in the history
…n 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
  • Loading branch information
Erich Keane committed Sep 5, 2017
1 parent 1aa667f commit e916d54
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions clang/lib/Lex/Lexer.cpp
Expand Up @@ -3071,10 +3071,11 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
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) {
Expand Down

0 comments on commit e916d54

Please sign in to comment.