From e141a9e225e13b1cb6beb44fa25e18337096473c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 12 Dec 2008 07:34:39 +0000 Subject: rdar://6060752 - don't warn about trigraphs in bcpl-style comments llvm-svn: 60942 --- clang/lib/Lex/Lexer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'clang/lib/Lex') diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index b071a7525f7..e6030ad1d45 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/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 -- cgit v1.2.3