summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Bitcode/Reader')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp34
-rw-r--r--llvm/lib/Bitcode/Reader/BitstreamReader.cpp6
2 files changed, 3 insertions, 37 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index b849db4427a..bb479dbcedc 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -2363,7 +2363,7 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
NextMetadataNo++);
break;
}
- case bitc::METADATA_STRING_OLD: {
+ case bitc::METADATA_STRING: {
std::string String(Record.begin(), Record.end());
// Test for upgrading !llvm.loop.
@@ -2373,38 +2373,6 @@ std::error_code BitcodeReader::parseMetadata(bool ModuleLevel) {
MetadataList.assignValue(MD, NextMetadataNo++);
break;
}
- case bitc::METADATA_BULK_STRING_SIZES: {
- // This is a pair of records for an MDString block: SIZES, which is a
- // list of string lengths; and DATA, which is a blob with all the strings
- // concatenated together.
- //
- // Note: since this record type was introduced after the upgrade for
- // !llvm.loop, we don't need to change HasSeenOldLoopTags.
- if (Record.empty())
- return error("Invalid record: missing bulk metadata string sizes");
-
- StringRef Blob;
- SmallVector<uint64_t, 1> BlobRecord;
- Code = Stream.ReadCode();
- unsigned BlobCode = Stream.readRecord(Code, BlobRecord, &Blob);
- if (BlobCode != bitc::METADATA_BULK_STRING_DATA)
- return error("Invalid record: missing bulk metadata string data");
- if (!BlobRecord.empty())
- return error("Invalid record: unexpected bulk metadata arguments");
-
- for (uint64_t Size : Record) {
- if (Blob.size() < Size)
- return error("Invalid record: not enough bulk metadata string bytes");
-
- // Extract the current string.
- MetadataList.assignValue(MDString::get(Context, Blob.slice(0, Size)),
- NextMetadataNo++);
- Blob = Blob.drop_front(Size);
- }
- if (!Blob.empty())
- return error("Invalid record: too many bulk metadata string bytes");
- break;
- }
case bitc::METADATA_KIND: {
// Support older bitcode files that had METADATA_KIND records in a
// block with METADATA_BLOCK_ID.
diff --git a/llvm/lib/Bitcode/Reader/BitstreamReader.cpp b/llvm/lib/Bitcode/Reader/BitstreamReader.cpp
index 43dae0c35a7..db9e0cd63ac 100644
--- a/llvm/lib/Bitcode/Reader/BitstreamReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitstreamReader.cpp
@@ -261,10 +261,6 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID,
}
// Otherwise, inform the streamer that we need these bytes in memory.
- // Skip over tail padding first. We can't do it later if this is a
- // streaming memory object, since that could reallocate the storage that
- // the blob pointer references.
- JumpToBit(NewEnd);
const char *Ptr = (const char*)
BitStream->getBitcodeBytes().getPointer(CurBitPos/8, NumElts);
@@ -276,6 +272,8 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID,
for (; NumElts; --NumElts)
Vals.push_back((unsigned char)*Ptr++);
}
+ // Skip over tail padding.
+ JumpToBit(NewEnd);
}
return Code;
OpenPOWER on IntegriCloud