[PATCH] D26016: BitcodeReader: Require clients to read the block info block at most once.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 16:24:43 PDT 2016


pcc created this revision.
pcc added a reviewer: mehdi_amini.
pcc added subscribers: llvm-commits, jordan_rose.

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


https://reviews.llvm.org/D26016

Files:
  llvm/lib/Bitcode/Reader/BitstreamReader.cpp


Index: llvm/lib/Bitcode/Reader/BitstreamReader.cpp
===================================================================
--- llvm/lib/Bitcode/Reader/BitstreamReader.cpp
+++ llvm/lib/Bitcode/Reader/BitstreamReader.cpp
@@ -319,9 +319,8 @@
 }
 
 bool BitstreamCursor::ReadBlockInfoBlock() {
-  // If this is the second stream to get to the block info block, skip it.
-  if (getBitStreamReader()->hasBlockInfoRecords())
-    return SkipBlock();
+  // We expect the client to read the block info block at most once.
+  assert(!getBitStreamReader()->hasBlockInfoRecords());
 
   if (EnterSubBlock(bitc::BLOCKINFO_BLOCK_ID)) return true;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26016.75962.patch
Type: text/x-patch
Size: 631 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161026/33103306/attachment.bin>


More information about the llvm-commits mailing list