[cfe-commits] r173701 - PR15067 (again): Don't warn about UCNs in C90 if we're raw-lexing.

Jordan Rose jordan_rose at apple.com
Mon Jan 28 09:49:02 PST 2013


Author: jrose
Date: Mon Jan 28 11:49:02 2013
New Revision: 173701

URL: http://llvm.org/viewvc/llvm-project?rev=173701&view=rev
Log:
PR15067 (again): Don't warn about UCNs in C90 if we're raw-lexing.

Fixes a crash. Thanks, Richard.

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

Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=173701&r1=173700&r2=173701&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Mon Jan 28 11:49:02 2013
@@ -2710,7 +2710,8 @@ uint32_t Lexer::tryReadUCN(const char *&
     return 0;
 
   if (!LangOpts.CPlusPlus && !LangOpts.C99) {
-    Diag(SlashLoc, diag::warn_ucn_not_valid_in_c89);
+    if (Result && !isLexingRawMode())
+      Diag(SlashLoc, diag::warn_ucn_not_valid_in_c89);
     return 0;
   }
 

Modified: cfe/trunk/test/Lexer/c90.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/c90.c?rev=173701&r1=173700&r2=173701&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/c90.c (original)
+++ cfe/trunk/test/Lexer/c90.c Mon Jan 28 11:49:02 2013
@@ -41,3 +41,6 @@ int test4() {
 }
 
 #define MY_UCN \u00FC // expected-warning {{universal character names are only valid in C99 or C++; treating as '\' followed by identifier}}
+#define NOT_A_UCN \h // no-warning
+
+extern int idWithUCN\u00FC; // expected-warning {{universal character names are only valid in C99 or C++; treating as '\' followed by identifier}} expected-error {{expected ';'}}





More information about the cfe-commits mailing list