<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 27, 2013, at 16:04 , Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">On Sun, Jan 27, 2013 at 12:12 PM, Jordan Rose <span dir="ltr"><<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">
Author: jrose<br>
Date: Sun Jan 27 14:12:04 2013<br>
New Revision: 173622<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=173622&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=173622&view=rev</a><br>
Log:<br>
PR15067: Don't assert when a UCN appears in a C90 file.<br>
<br>
Unfortunately, we can't accept the UCN as an extension because we're<br>
required to treat it as two tokens for preprocessing purposes.<br>
<br>
Modified:<br>
    cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td<br>
    cfe/trunk/lib/Lex/Lexer.cpp<br>
    cfe/trunk/lib/Lex/LiteralSupport.cpp<br>
    cfe/trunk/test/Lexer/c90.c<br>
<br>
Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=173622&r1=173621&r2=173622&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=173622&r1=173621&r2=173622&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Sun Jan 27 14:12:04 2013<br>
@@ -127,6 +127,11 @@ def warn_cxx98_compat_literal_ucn_escape<br>
 def warn_cxx98_compat_literal_ucn_control_character : Warning<<br>
   "universal character name referring to a control character "<br>
   "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;<br>
+def warn_ucn_not_valid_in_c89 : Warning<<br>
+  "universal character names are only valid in C99 or C++; "<br>
+  "treating as '\\' followed by identifier">, InGroup<Unicode>;<br>
+def warn_ucn_not_valid_in_c89_literal : ExtWarn<<br>
+  "universal character names are only valid in C99 or C++">, InGroup<Unicode>;<br>
<br>
<br>
 // Literal<br>
@@ -165,8 +170,6 @@ def ext_string_too_long : Extension<"str<br>
   "support">, InGroup<OverlengthStrings>;<br>
 def err_character_too_large : Error<<br>
   "character too large for enclosing character literal type">;<br>
-def warn_ucn_not_valid_in_c89 : ExtWarn<<br>
-  "unicode escape sequences are only valid in C99 or C++">, InGroup<Unicode>;<br>
 def warn_cxx98_compat_unicode_literal : Warning<<br>
   "unicode literals are incompatible with C++98">,<br>
   InGroup<CXX98Compat>, DefaultIgnore;<br>
<br>
Modified: cfe/trunk/lib/Lex/Lexer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=173622&r1=173621&r2=173622&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=173622&r1=173621&r2=173622&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/Lex/Lexer.cpp (original)<br>
+++ cfe/trunk/lib/Lex/Lexer.cpp Sun Jan 27 14:12:04 2013<br>
@@ -2698,8 +2698,6 @@ bool Lexer::isCodeCompletionPoint(const<br>
<br>
 uint32_t Lexer::tryReadUCN(const char *&StartPtr, const char *SlashLoc,<br>
                            Token *Result) {<br>
-  assert(LangOpts.CPlusPlus || LangOpts.C99);<br>
-<br>
   unsigned CharSize;<br>
   char Kind = getCharAndSize(StartPtr, CharSize);<br>
<br>
@@ -2711,6 +2709,11 @@ uint32_t Lexer::tryReadUCN(const char *&<br>
   else<br>
     return 0;<br>
<br>
+  if (!LangOpts.CPlusPlus && !LangOpts.C99) {<br>
+    Diag(SlashLoc, diag::warn_ucn_not_valid_in_c89);<br></blockquote><div><br></div><div>Should there be an isLexingRawMode() test here?</div></div></blockquote><br></div><div>Thanks for the catch! Fixed in r173701.</div><br></body></html>