]> granicus.if.org Git - clang/commitdiff
Fix diagnostic for reporting bad escape sequence.
authorTed Kremenek <kremenek@apple.com>
Fri, 3 Dec 2010 00:09:56 +0000 (00:09 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 3 Dec 2010 00:09:56 +0000 (00:09 +0000)
Patch by Paul Curtis!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120759 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/LiteralSupport.cpp
test/Lexer/char-escapes.c

index 7857ae440a0156dde555950be3b0baba808638df..7f4ea0e9a3a4e344e50e64f82cd46d5ceb8b1ce5 100644 (file)
@@ -151,7 +151,7 @@ static unsigned ProcessCharEscape(const char *&ThisTokBuf,
     if (Diags == 0)
       break;
       
-    if (isgraph(ThisTokBuf[0]))
+    if (isgraph(ResultChar))
       Diags->Report(Loc, diag::ext_unknown_escape)
         << std::string()+(char)ResultChar;
     else
index d918bf4cf07c92b02f53cc6b4547e69e533b4f88..32a1c6140d53cad546494099d0bb75f49845ff87 100644 (file)
@@ -19,3 +19,4 @@ int test['\(' == 40 ? 1 : -1]; // expected-warning {{non-standard escape}}
 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'}}