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

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 5 13:47:26 PDT 2017


Test?

On Tue, Sep 5, 2017 at 1:32 PM, Erich Keane via cfe-commits <
cfe-commits at 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 at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170905/6f6329eb/attachment.html>


More information about the cfe-commits mailing list