]> granicus.if.org Git - clang/commitdiff
rdar://6060752 - don't warn about trigraphs in bcpl-style comments
authorChris Lattner <sabre@nondot.org>
Fri, 12 Dec 2008 07:34:39 +0000 (07:34 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 12 Dec 2008 07:34:39 +0000 (07:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60942 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/Lexer.cpp
test/Lexer/block_cmt_end.c

index b071a7525f798616d57d0dbc83b6de30aa0ea4f0..e6030ad1d4586e5c8689fd9cdd63f34b5780c44a 100644 (file)
@@ -777,9 +777,14 @@ bool Lexer::SkipBCPLComment(Token &Result, const char *CurPtr) {
       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
index 347f78f5e8d6e24e37d8ffcca590a4628014d3b0..1f0eefddf2018971ee8e09f088986b028f42bf71 100644 (file)
@@ -28,3 +28,11 @@ next comment ends with a trigraph escaped newline: */
 
 foo /* expected-error {{expected '=', ',', ';', 'asm', or '__attribute__' after declarator}} */
 
+
+// rdar://6060752 - We should not get warnings about trigraphs in comments:
+// '????'
+/* ???? */
+
+
+
+