From: Chris Lattner Date: Tue, 23 Jun 2009 05:15:06 +0000 (+0000) Subject: Fix our check for "random whitespace between a \ and newline" to work X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5636a3b6ece2c1f413464b72545e08eb0b7f06e4;p=clang Fix our check for "random whitespace between a \ and newline" to work with dos style newlines. I have a trivial test for this: // RUN: clang-cc %s -verify #define test(x, y) \ x ## y but I don't know how to get svn to not change newlines and testrunner doesn't work with dos style newlines either, so "not worth it". :) rdar://6994000 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73945 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index c2ffd6d433..81ea606f0d 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -473,13 +473,14 @@ Slash: // Common case, backslash-char where the char is not whitespace. if (!isWhitespace(Ptr[0])) return '\\'; - // See if we have optional whitespace characters followed by a newline. + // See if we have optional whitespace characters between the slash and + // newline. if (unsigned EscapedNewLineSize = getEscapedNewLineSize(Ptr)) { // Remember that this token needs to be cleaned. if (Tok) Tok->setFlag(Token::NeedsCleaning); // Warn if there was whitespace between the backslash and newline. - if (EscapedNewLineSize != 1 && Tok && !isLexingRawMode()) + if (Ptr[0] != '\n' && Ptr[0] != '\r' && Tok && !isLexingRawMode()) Diag(Ptr, diag::backslash_newline_space); // Found backslash. Parse the char after it.