[llvm] r285350 - BitcodeReader: Require clients to read the block info block at most once.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 14:39:29 PDT 2016


Author: pcc
Date: Thu Oct 27 16:39:28 2016
New Revision: 285350

URL: http://llvm.org/viewvc/llvm-project?rev=285350&view=rev
Log:
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

Modified:
    llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp

Modified: llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp?rev=285350&r1=285349&r2=285350&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitstreamReader.cpp Thu Oct 27 16:39:28 2016
@@ -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;
 




More information about the llvm-commits mailing list