diff options
Diffstat (limited to 'lib/Lex/Lexer.cpp')
-rw-r--r-- | lib/Lex/Lexer.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp index 429780eaea..91c4f66403 100644 --- a/lib/Lex/Lexer.cpp +++ b/lib/Lex/Lexer.cpp @@ -2698,8 +2698,6 @@ bool Lexer::isCodeCompletionPoint(const char *CurPtr) const { uint32_t Lexer::tryReadUCN(const char *&StartPtr, const char *SlashLoc, Token *Result) { - assert(LangOpts.CPlusPlus || LangOpts.C99); - unsigned CharSize; char Kind = getCharAndSize(StartPtr, CharSize); @@ -2711,6 +2709,11 @@ uint32_t Lexer::tryReadUCN(const char *&StartPtr, const char *SlashLoc, else return 0; + if (!LangOpts.CPlusPlus && !LangOpts.C99) { + Diag(SlashLoc, diag::warn_ucn_not_valid_in_c89); + return 0; + } + const char *CurPtr = StartPtr + CharSize; const char *KindLoc = &CurPtr[-1]; @@ -2737,7 +2740,7 @@ uint32_t Lexer::tryReadUCN(const char *&StartPtr, const char *SlashLoc, } } } - + return 0; } |