aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-01-28 17:49:02 +0000
committerJordan Rose <jordan_rose@apple.com>2013-01-28 17:49:02 +0000
commit8094bac4e987caf90e8fd719c24545add8dafcb6 (patch)
tree9a563587ba8f276fa661bd0721ba2a6b554ac685
parenta522987e420eade60baba7d67a38e5c9500d2582 (diff)
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
-rw-r--r--lib/Lex/Lexer.cpp3
-rw-r--r--test/Lexer/c90.c3
2 files changed, 5 insertions, 1 deletions
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 ';'}}