From 8094bac4e987caf90e8fd719c24545add8dafcb6 Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Mon, 28 Jan 2013 17:49:02 +0000 Subject: [PATCH] PR15067 (again): Don't warn about UCNs in C90 if we're raw-lexing. Fixes a crash. Thanks, Richard. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173701 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/Lexer.cpp | 3 ++- test/Lexer/c90.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 91c4f66403..3e3aaae5f5 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -2710,7 +2710,8 @@ uint32_t Lexer::tryReadUCN(const char *&StartPtr, const char *SlashLoc, return 0; if (!LangOpts.CPlusPlus && !LangOpts.C99) { - Diag(SlashLoc, diag::warn_ucn_not_valid_in_c89); + if (Result && !isLexingRawMode()) + Diag(SlashLoc, diag::warn_ucn_not_valid_in_c89); return 0; } diff --git a/test/Lexer/c90.c b/test/Lexer/c90.c index 826d910b29..649173d71d 100644 --- a/test/Lexer/c90.c +++ b/test/Lexer/c90.c @@ -41,3 +41,6 @@ int test4() { } #define MY_UCN \u00FC // expected-warning {{universal character names are only valid in C99 or C++; treating as '\' followed by identifier}} +#define NOT_A_UCN \h // no-warning + +extern int idWithUCN\u00FC; // expected-warning {{universal character names are only valid in C99 or C++; treating as '\' followed by identifier}} expected-error {{expected ';'}} -- 2.40.0