[cfe-commits] r120759 - in /cfe/trunk: lib/Lex/LiteralSupport.cpp test/Lexer/char-escapes.c

Ted Kremenek kremenek at apple.com
Thu Dec 2 16:09:56 PST 2010


Author: kremenek
Date: Thu Dec  2 18:09:56 2010
New Revision: 120759

URL: http://llvm.org/viewvc/llvm-project?rev=120759&view=rev
Log:
Fix diagnostic for reporting bad escape sequence.
Patch by Paul Curtis!

Modified:
    cfe/trunk/lib/Lex/LiteralSupport.cpp
    cfe/trunk/test/Lexer/char-escapes.c

Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=120759&r1=120758&r2=120759&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Thu Dec  2 18:09:56 2010
@@ -151,7 +151,7 @@
     if (Diags == 0)
       break;
       
-    if (isgraph(ThisTokBuf[0]))
+    if (isgraph(ResultChar))
       Diags->Report(Loc, diag::ext_unknown_escape)
         << std::string()+(char)ResultChar;
     else

Modified: cfe/trunk/test/Lexer/char-escapes.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/char-escapes.c?rev=120759&r1=120758&r2=120759&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/char-escapes.c (original)
+++ cfe/trunk/test/Lexer/char-escapes.c Thu Dec  2 18:09:56 2010
@@ -19,3 +19,4 @@
 int test['\{' == 123 ? 1 : -1]; // expected-warning {{non-standard escape}}
 int test['\[' == 91 ? 1 : -1]; // expected-warning {{non-standard escape}}
 int test['\%' == 37 ? 1 : -1]; // expected-warning {{non-standard escape}}
+const char *format = "abc \m def"; // expected-warning{{unknown escape sequence '\m'}}





More information about the cfe-commits mailing list