1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

BitcodeReader: Require clients to read the block info block at most once.

This change makes it the client's responsibility to call ReadBlockInfoBlock()
at most once. This is in preparation for a future change that will allow
there to be multiple block info blocks.

See also: http://lists.llvm.org/pipermail/llvm-dev/2016-October/106512.html

Differential Revision: https://reviews.llvm.org/D26016

llvm-svn: 285350
This commit is contained in:
Peter Collingbourne 2016-10-27 21:39:28 +00:00
parent 2446e56186
commit 5c2a0fc93d

View File

@ -319,9 +319,9 @@ void BitstreamCursor::ReadAbbrevRecord() {
} }
bool BitstreamCursor::ReadBlockInfoBlock() { bool BitstreamCursor::ReadBlockInfoBlock() {
// If this is the second stream to get to the block info block, skip it. // We expect the client to read the block info block at most once.
if (getBitStreamReader()->hasBlockInfoRecords()) if (getBitStreamReader()->hasBlockInfoRecords())
return SkipBlock(); report_fatal_error("Duplicate read of block info block");
if (EnterSubBlock(bitc::BLOCKINFO_BLOCK_ID)) return true; if (EnterSubBlock(bitc::BLOCKINFO_BLOCK_ID)) return true;