]> granicus.if.org Git - llvm/commitdiff
BitcodeReader: Require clients to read the block info block at most once.
authorPeter Collingbourne <peter@pcc.me.uk>
Thu, 27 Oct 2016 21:39:28 +0000 (21:39 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 27 Oct 2016 21:39:28 +0000 (21:39 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285350 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bitcode/Reader/BitstreamReader.cpp

index 330bc045cc678792e4e47cf9a8e32b030b7d9a3d..0b549f7550f73bdb3bad4db5d3e17514c65ae4b2 100644 (file)
@@ -319,9 +319,9 @@ void BitstreamCursor::ReadAbbrevRecord() {
 }
 
 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())
-    return SkipBlock();
+    report_fatal_error("Duplicate read of block info block");
 
   if (EnterSubBlock(bitc::BLOCKINFO_BLOCK_ID)) return true;