Index: lib/Bitcode/Writer/BitcodeWriter.cpp =================================================================== --- lib/Bitcode/Writer/BitcodeWriter.cpp +++ lib/Bitcode/Writer/BitcodeWriter.cpp @@ -278,10 +278,10 @@ StringRef Val = Attr.getValueAsString(); Record.push_back(Val.empty() ? 3 : 4); - Record.append(Kind.begin(), Kind.end()); + Record.append((uint8_t*)Kind.begin(), (uint8_t*)Kind.end()); Record.push_back(0); if (!Val.empty()) { - Record.append(Val.begin(), Val.end()); + Record.append((uint8_t*)Val.begin(), (uint8_t*)Val.end()); Record.push_back(0); } } @@ -784,7 +784,7 @@ } // Code: [strchar x N] - Record.append(MDS->begin(), MDS->end()); + Record.append((uint8_t *)MDS->begin(), (uint8_t *)MDS->end()); // Emit the finished record. Stream.EmitRecord(bitc::METADATA_STRING, Record, MDSAbbrev); @@ -887,7 +887,7 @@ for (unsigned MDKindID = 0, e = Names.size(); MDKindID != e; ++MDKindID) { Record.push_back(MDKindID); StringRef KName = Names[MDKindID]; - Record.append(KName.begin(), KName.end()); + Record.append((uint8_t*)KName.begin(), (uint8_t*)KName.end()); Stream.EmitRecord(bitc::METADATA_KIND, Record, 0); Record.clear(); Index: test/Bitcode/unicode.ll =================================================================== --- /dev/null +++ test/Bitcode/unicode.ll @@ -0,0 +1,11 @@ +; RUN: llvm-as < %s | llvm-dis | FileCheck %s + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!5} + +!0 = metadata !{metadata !"0x11\0012\00clang version ☃\001\00\000\00\000", metadata !4, metadata !2, metadata !2, metadata !2, metadata !2, null} ; [ DW_TAG_compile_unit ] +; CHECK: "0x11\0012\00clang version \E2\98\83\001\00\000\00\000" +!2 = metadata !{} +!3 = metadata !{metadata !"0x29", metadata !4} ; [ DW_TAG_file_type ] +!4 = metadata !{metadata !"empty.c", metadata !"/tmp"} +!5 = metadata !{i32 1, metadata !"Debug Info Version", i32 2}