mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-14 09:38:40 +00:00
MSVC's implementation of isalnum will assert on characters > 255, so we need to use an unsigned char to ensure the integer promotion happens properly. This fixes an assert in debug builds with CodeGen\X86\utf8.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160286 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c0ed3e548c
commit
09dab827b2
@ -100,7 +100,11 @@ static void PrintLLVMName(raw_ostream &OS, StringRef Name, PrefixType Prefix) {
|
|||||||
bool NeedsQuotes = isdigit(Name[0]);
|
bool NeedsQuotes = isdigit(Name[0]);
|
||||||
if (!NeedsQuotes) {
|
if (!NeedsQuotes) {
|
||||||
for (unsigned i = 0, e = Name.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Name.size(); i != e; ++i) {
|
||||||
char C = Name[i];
|
// By making this unsigned, the value passed in to isalnum will always be
|
||||||
|
// in the range 0-255. This is important when building with MSVC because
|
||||||
|
// its implementation will assert. This situation can arise when dealing
|
||||||
|
// with UTF-8 multibyte characters.
|
||||||
|
unsigned char C = Name[i];
|
||||||
if (!isalnum(C) && C != '-' && C != '.' && C != '_') {
|
if (!isalnum(C) && C != '-' && C != '.' && C != '_') {
|
||||||
NeedsQuotes = true;
|
NeedsQuotes = true;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user