[PATCH] D14804: [clang] Disable Unicode in asm files
Vinicius Tinti via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 18 18:38:57 PST 2015
tinti created this revision.
tinti added reviewers: rengolin, zatrazz, compnerd.
tinti added a subscriber: cfe-commits.
tinti set the repository for this revision to rL LLVM.
Clang should not convert tokens to Unicode when preprocessing assembly
files.
Fixes PR25558
Repository:
rL LLVM
http://reviews.llvm.org/D14804
Files:
lib/Lex/Lexer.cpp
test/CodeGen/asm-unicode.S
test/CodeGen/c-unicode.c
Index: test/CodeGen/c-unicode.c
===================================================================
--- test/CodeGen/c-unicode.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// RUN: %clang -S %s -o - | FileCheck %s -check-prefix=ALLOWED
-// RUN: not %clang -std=c89 -S %s -o - 2>&1 | FileCheck %s -check-prefix=DENIED
-int \uaccess = 0;
-// ALLOWED: "곎ss":
-// ALLOWED-NOT: "\uaccess":
-// DENIED: warning: universal character names are only valid in C99 or C++; treating as '\' followed by identifier [-Wunicode]
-// DENIED: error: expected identifier or '('
Index: test/CodeGen/asm-unicode.S
===================================================================
--- test/CodeGen/asm-unicode.S
+++ /dev/null
@@ -1,12 +0,0 @@
-// RUN: %clang -S %s -o - | FileCheck %s
-.macro my_macro, trace=1, uaccess=1
-.if \uaccess
-// CHECK: .if \uaccess
-// CHECK-NOT: .if 곎ss
-// CHECK: my_macro trace=1
- my_macro trace=1
-.endif
-.endm
-
-foo:
- my_macro trace=0
Index: lib/Lex/Lexer.cpp
===================================================================
--- lib/Lex/Lexer.cpp
+++ lib/Lex/Lexer.cpp
@@ -1354,9 +1354,7 @@
}
static bool isAllowedIDChar(uint32_t C, const LangOptions &LangOpts) {
- if (LangOpts.AsmPreprocessor) {
- return false;
- } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+ if (LangOpts.CPlusPlus11 || LangOpts.C11) {
static const llvm::sys::UnicodeCharSet C11AllowedIDChars(
C11AllowedIDCharRanges);
return C11AllowedIDChars.contains(C);
@@ -1373,9 +1371,7 @@
static bool isAllowedInitiallyIDChar(uint32_t C, const LangOptions &LangOpts) {
assert(isAllowedIDChar(C, LangOpts));
- if (LangOpts.AsmPreprocessor) {
- return false;
- } else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
+ if (LangOpts.CPlusPlus11 || LangOpts.C11) {
static const llvm::sys::UnicodeCharSet C11DisallowedInitialIDChars(
C11DisallowedInitialIDCharRanges);
return !C11DisallowedInitialIDChars.contains(C);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14804.40594.patch
Type: text/x-patch
Size: 1961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151119/b63baeb3/attachment-0001.bin>
More information about the cfe-commits
mailing list