aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2012-07-16 16:18:18 +0000
committerAaron Ballman <aaron@aaronballman.com>2012-07-16 16:18:18 +0000
commit09dab827b2923fd201070fc87df435fabc3abcf7 (patch)
tree617cb3b3f1555c78b8347b9fcb3fca0343366d5b /lib/VMCore
parentc0ed3e548c6f688e22685de04e210c7b59ac3433 (diff)
downloadexternal_llvm-09dab827b2923fd201070fc87df435fabc3abcf7.zip
external_llvm-09dab827b2923fd201070fc87df435fabc3abcf7.tar.gz
external_llvm-09dab827b2923fd201070fc87df435fabc3abcf7.tar.bz2
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
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AsmWriter.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 669d308..aedb86b 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/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;