From 23ef69d197ba3b5e9602f7161fee50990059502a Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 3 Dec 2010 00:09:56 +0000 Subject: [PATCH] Fix diagnostic for reporting bad escape sequence. 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 | 2 +- test/Lexer/char-escapes.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp index 7857ae440a..7f4ea0e9a3 100644 --- a/lib/Lex/LiteralSupport.cpp +++ b/lib/Lex/LiteralSupport.cpp @@ -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 diff --git a/test/Lexer/char-escapes.c b/test/Lexer/char-escapes.c index d918bf4cf0..32a1c6140d 100644 --- a/test/Lexer/char-escapes.c +++ b/test/Lexer/char-escapes.c @@ -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'}}