summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-06-23 05:15:06 +0000
committerChris Lattner <sabre@nondot.org>2009-06-23 05:15:06 +0000
commitc1835955342f7672ee2f03567aa2cc464498ada8 (patch)
tree9798fafdceadf3f70aa741333e2feb00da37c770
parent02a9191b717090da0ec8446028287ea7af998399 (diff)
downloadbcm5719-llvm-c1835955342f7672ee2f03567aa2cc464498ada8.tar.gz
bcm5719-llvm-c1835955342f7672ee2f03567aa2cc464498ada8.zip
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 llvm-svn: 73945
-rw-r--r--clang/lib/Lex/Lexer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp
index c2ffd6d4339..81ea606f0d9 100644
--- a/clang/lib/Lex/Lexer.cpp
+++ b/clang/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<whitespace><newline>. Parse the char after it.
OpenPOWER on IntegriCloud