[cfe-commits] r148991 - in /cfe/trunk: include/clang/Basic/DiagnosticLexKinds.td test/Lexer/char-literal-encoding-error.c test/Lexer/string-literal-encoding.c

Eli Friedman eli.friedman at gmail.com
Wed Jan 25 14:34:12 PST 2012


Author: efriedma
Date: Wed Jan 25 16:34:12 2012
New Revision: 148991

URL: http://llvm.org/viewvc/llvm-project?rev=148991&view=rev
Log:
Improve the error message slightly for files that aren't using the expected UTF-8 encoding.  Patch by Seth Cantrell.


Modified:
    cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
    cfe/trunk/test/Lexer/char-literal-encoding-error.c
    cfe/trunk/test/Lexer/string-literal-encoding.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=148991&r1=148990&r2=148991&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Wed Jan 25 16:34:12 2012
@@ -133,9 +133,9 @@
 def err_unsupported_string_concat : Error<
   "unsupported non-standard concatenation of string literals">;
 def err_bad_string_encoding : Error<
-  "illegal sequence in string literal">;
+  "illegal character encoding in string literal">;
 def err_bad_character_encoding : Error<
-  "illegal sequence in character literal">;
+  "illegal character encoding in character literal">;
   
 //===----------------------------------------------------------------------===//
 // PTH Diagnostics

Modified: cfe/trunk/test/Lexer/char-literal-encoding-error.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/char-literal-encoding-error.c?rev=148991&r1=148990&r2=148991&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/char-literal-encoding-error.c (original)
+++ cfe/trunk/test/Lexer/char-literal-encoding-error.c Wed Jan 25 16:34:12 2012
@@ -3,8 +3,8 @@
 // This file is encoded using ISO-8859-1
 
 int main() {
-  'é'; // expected-error {{illegal sequence in character literal}}
-  u'é'; // expected-error {{illegal sequence in character literal}}
-  U'é'; // expected-error {{illegal sequence in character literal}}
-  L'é'; // expected-error {{illegal sequence in character literal}}
+  'é'; // expected-error {{illegal character encoding in character literal}}
+  u'é'; // expected-error {{illegal character encoding in character literal}}
+  U'é'; // expected-error {{illegal character encoding in character literal}}
+  L'é'; // expected-error {{illegal character encoding in character literal}}
 }

Modified: cfe/trunk/test/Lexer/string-literal-encoding.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/string-literal-encoding.c?rev=148991&r1=148990&r2=148991&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/string-literal-encoding.c (original)
+++ cfe/trunk/test/Lexer/string-literal-encoding.c Wed Jan 25 16:34:12 2012
@@ -5,11 +5,11 @@
 // U+00F5 U+00FC
 
 void f() {
-    wchar_t const *a = L"Àéîõü"; // expected-error {{illegal sequence in string literal}}
+    wchar_t const *a = L"Àéîõü"; // expected-error {{illegal character encoding in string literal}}
 
-    char16_t const *b = u"Àéîõü"; // expected-error {{illegal sequence in string literal}}
-    char32_t const *c = U"Àéîõü"; // expected-error {{illegal sequence in string literal}}
-    wchar_t const *d = LR"(Àéîõü)"; // expected-error {{illegal sequence in string literal}}
-    char16_t const *e = uR"(Àéîõü)"; // expected-error {{illegal sequence in string literal}}
-    char32_t const *f = UR"(Àéîõü)"; // expected-error {{illegal sequence in string literal}}
+    char16_t const *b = u"Àéîõü"; // expected-error {{illegal character encoding in string literal}}
+    char32_t const *c = U"Àéîõü"; // expected-error {{illegal character encoding in string literal}}
+    wchar_t const *d = LR"(Àéîõü)"; // expected-error {{illegal character encoding in string literal}}
+    char16_t const *e = uR"(Àéîõü)"; // expected-error {{illegal character encoding in string literal}}
+    char32_t const *f = UR"(Àéîõü)"; // expected-error {{illegal character encoding in string literal}}
 }





More information about the cfe-commits mailing list