diff options
| author | Aaron Ballman <aaron@aaronballman.com> | 2012-07-16 16:18:18 +0000 |
|---|---|---|
| committer | Aaron Ballman <aaron@aaronballman.com> | 2012-07-16 16:18:18 +0000 |
| commit | ed9b0a91148a38b973cdb5bdd0e803d17ee36bf6 (patch) | |
| tree | a417c43a50acc46ab405fc0bdddbb7e97643e46d | |
| parent | 403845ba75f6b1663013cfac10766e2ef3cd27c3 (diff) | |
| download | bcm5719-llvm-ed9b0a91148a38b973cdb5bdd0e803d17ee36bf6.tar.gz bcm5719-llvm-ed9b0a91148a38b973cdb5bdd0e803d17ee36bf6.zip | |
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
llvm-svn: 160286
| -rw-r--r-- | llvm/lib/VMCore/AsmWriter.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index 669d308b1a1..aedb86b3eed 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -100,7 +100,11 @@ static void PrintLLVMName(raw_ostream &OS, StringRef Name, PrefixType Prefix) { bool NeedsQuotes = isdigit(Name[0]); if (!NeedsQuotes) { 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 != '_') { NeedsQuotes = true; break; |

