[cfe-commits] r39636 - /cfe/cfe/trunk/Lex/Lexer.cpp
clattner at cs.uiuc.edu
clattner at cs.uiuc.edu
Wed Jul 11 09:46:30 PDT 2007
Author: clattner
Date: Wed Jul 11 11:46:29 2007
New Revision: 39636
URL: http://llvm.org/viewvc/llvm-project?rev=39636&view=rev
Log:
Don't warn about escaped newlines in // comments if the next line is also
a // comment, this reduces noise in the llvm testsuite.
Modified:
cfe/cfe/trunk/Lex/Lexer.cpp
Modified: cfe/cfe/trunk/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Lexer.cpp?rev=39636&r1=39635&r2=39636&view=diff
==============================================================================
--- cfe/cfe/trunk/Lex/Lexer.cpp (original)
+++ cfe/cfe/trunk/Lex/Lexer.cpp Wed Jul 11 11:46:29 2007
@@ -643,10 +643,21 @@
C = getAndAdvanceChar(CurPtr, Result);
// If we read multiple characters, and one of those characters was a \r or
- // \n, then we had an escaped newline within the comment. Emit diagnostic.
- if (CurPtr != OldPtr+1) {
+ // \n, then we had an escaped newline within the comment. Emit diagnostic
+ // unless the next line is also a // comment.
+ if (CurPtr != OldPtr+1 && C != '/' && CurPtr[0] != '/') {
for (; OldPtr != CurPtr; ++OldPtr)
if (OldPtr[0] == '\n' || OldPtr[0] == '\r') {
+ // Okay, we found a // comment that ends in a newline, if the next
+ // line is also a // comment, but has spaces, don't emit a diagnostic.
+ if (isspace(C)) {
+ const char *ForwardPtr = CurPtr;
+ while (isspace(*ForwardPtr)) // Skip whitespace.
+ ++ForwardPtr;
+ if (ForwardPtr[0] == '/' && ForwardPtr[1] == '/')
+ break;
+ }
+
Diag(OldPtr-1, diag::ext_multi_line_bcpl_comment);
break;
}
More information about the cfe-commits
mailing list