[cfe-commits] r60942 - in /cfe/trunk: lib/Lex/Lexer.cpp test/Lexer/block_cmt_end.c

Chris Lattner sabre at nondot.org
Thu Dec 11 23:34:40 PST 2008


Author: lattner
Date: Fri Dec 12 01:34:39 2008
New Revision: 60942

URL: http://llvm.org/viewvc/llvm-project?rev=60942&view=rev
Log:
rdar://6060752 - don't warn about trigraphs in bcpl-style comments

Modified:
    cfe/trunk/lib/Lex/Lexer.cpp
    cfe/trunk/test/Lexer/block_cmt_end.c

Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=60942&r1=60941&r2=60942&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Fri Dec 12 01:34:39 2008
@@ -777,9 +777,14 @@
       break;  // Found the newline? Break out!
     
     // Otherwise, this is a hard case.  Fall back on getAndAdvanceChar to
-    // properly decode the character.
+    // properly decode the character.  Read it in raw mode to avoid emitting
+    // diagnostics about things like trigraphs.  If we see an escaped newline,
+    // we'll handle it below.
     const char *OldPtr = CurPtr;
+    bool OldRawMode = isLexingRawMode();
+    LexingRawMode = true;
     C = getAndAdvanceChar(CurPtr, Result);
+    LexingRawMode = OldRawMode;
     
     // 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

Modified: cfe/trunk/test/Lexer/block_cmt_end.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/block_cmt_end.c?rev=60942&r1=60941&r2=60942&view=diff

==============================================================================
--- cfe/trunk/test/Lexer/block_cmt_end.c (original)
+++ cfe/trunk/test/Lexer/block_cmt_end.c Fri Dec 12 01:34:39 2008
@@ -28,3 +28,11 @@
 
 foo /* expected-error {{expected '=', ',', ';', 'asm', or '__attribute__' after declarator}} */
 
+
+// rdar://6060752 - We should not get warnings about trigraphs in comments:
+// '????'
+/* ???? */
+
+
+
+





More information about the cfe-commits mailing list