diff options
| -rw-r--r-- | clang/lib/Lex/Lexer.cpp | 20 | ||||
| -rw-r--r-- | clang/test/Lexer/asm-preproc-no-unicode.s | 8 |
2 files changed, 19 insertions, 9 deletions
diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 6025a667512..4c051939471 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -3603,17 +3603,19 @@ LexNextToken: // UCNs (C99 6.4.3, C++11 [lex.charset]p2) case '\\': - if (uint32_t CodePoint = tryReadUCN(CurPtr, BufferPtr, &Result)) { - if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) { - if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) - return true; // KeepWhitespaceMode + if (!LangOpts.AsmPreprocessor) { + if (uint32_t CodePoint = tryReadUCN(CurPtr, BufferPtr, &Result)) { + if (CheckUnicodeWhitespace(Result, CodePoint, CurPtr)) { + if (SkipWhitespace(Result, CurPtr, TokAtPhysicalStartOfLine)) + return true; // KeepWhitespaceMode + + // We only saw whitespace, so just try again with this lexer. + // (We manually eliminate the tail call to avoid recursion.) + goto LexNextToken; + } - // We only saw whitespace, so just try again with this lexer. - // (We manually eliminate the tail call to avoid recursion.) - goto LexNextToken; + return LexUnicode(Result, CodePoint, CurPtr); } - - return LexUnicode(Result, CodePoint, CurPtr); } Kind = tok::unknown; diff --git a/clang/test/Lexer/asm-preproc-no-unicode.s b/clang/test/Lexer/asm-preproc-no-unicode.s new file mode 100644 index 00000000000..d194a52fec3 --- /dev/null +++ b/clang/test/Lexer/asm-preproc-no-unicode.s @@ -0,0 +1,8 @@ +// RUN: %clang -E -xassembler-with-cpp %s -o - 2>&1 | FileCheck %s + +// CHECK-NOT: warning: \u used with no following hex digits +// CHECK: .word \u + + .macro foo, u + .word \u + .endm |

