Bitcode: Use unsigned char to record MDStrings

`MDString`s can have arbitrary characters in them.  Prevent an assertion
that fired in `BitcodeWriter` because of sign extension by copying the
characters into the record as `unsigned char`s.

Based on a patch by Keno Fischer; fixes PR21882.

llvm-svn: 224077
This commit is contained in:
Duncan P. N. Exon Smith
2014-12-11 23:34:30 +00:00
parent 4688c23cf8
commit e45da1b1ef
4 changed files with 20 additions and 1 deletions
+1 -1
View File
@@ -800,7 +800,7 @@ static void WriteModuleMetadata(const Module *M,
}
// Code: [strchar x N]
Record.append(MDS->begin(), MDS->end());
Record.append(MDS->bytes_begin(), MDS->bytes_end());
// Emit the finished record.
Stream.EmitRecord(bitc::METADATA_STRING, Record, MDSAbbrev);