diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-12-03 00:09:56 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-12-03 00:09:56 +0000 |
commit | 23ef69d197ba3b5e9602f7161fee50990059502a (patch) | |
tree | 9ce8c5334cf12a40b35c5528f39be65ec68bb981 | |
parent | 8c00ad1e3897e8a00f41bbd52135be8390d5c15c (diff) |
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
-rw-r--r-- | lib/Lex/LiteralSupport.cpp | 2 | ||||
-rw-r--r-- | test/Lexer/char-escapes.c | 1 |
2 files changed, 2 insertions, 1 deletions
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'}} |