[llvm-commits] [llvm] r160286 - /llvm/trunk/lib/VMCore/AsmWriter.cpp
Aaron Ballman
aaron at aaronballman.com
Mon Jul 16 09:18:18 PDT 2012
Author: aaronballman
Date: Mon Jul 16 11:18:18 2012
New Revision: 160286
URL: http://llvm.org/viewvc/llvm-project?rev=160286&view=rev
Log:
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
Modified:
llvm/trunk/lib/VMCore/AsmWriter.cpp
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=160286&r1=160285&r2=160286&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Jul 16 11:18:18 2012
@@ -100,7 +100,11 @@
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;
More information about the llvm-commits
mailing list