aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-12-12 07:34:39 +0000
committerChris Lattner <sabre@nondot.org>2008-12-12 07:34:39 +0000
commitbc3e9842212b78bcf49682641307e4f3419ecc5e (patch)
tree3f75ef4ffde54dcaa542814f14e0ec826dfcedcb
parent3d8173c1c68f451c7492f92023d829c626845925 (diff)
rdar://6060752 - don't warn about trigraphs in bcpl-style comments
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60942 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Lex/Lexer.cpp7
-rw-r--r--test/Lexer/block_cmt_end.c8
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index b071a7525f..e6030ad1d4 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -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
diff --git a/test/Lexer/block_cmt_end.c b/test/Lexer/block_cmt_end.c
index 347f78f5e8..1f0eefddf2 100644
--- a/test/Lexer/block_cmt_end.c
+++ b/test/Lexer/block_cmt_end.c
@@ -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:
+// '????'
+/* ???? */
+
+
+
+