[cfe-commits] r73945 - /cfe/trunk/lib/Lex/Lexer.cpp

Chris Lattner sabre at nondot.org
Mon Jun 22 22:15:07 PDT 2009


Author: lattner
Date: Tue Jun 23 00:15:06 2009
New Revision: 73945

URL: http://llvm.org/viewvc/llvm-project?rev=73945&view=rev
Log:
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


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=73945&r1=73944&r2=73945&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Tue Jun 23 00:15:06 2009
@@ -473,13 +473,14 @@
     // 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<whitespace><newline>.  Parse the char after it.





More information about the cfe-commits mailing list