[llvm-commits] [llvm] r172928 - /llvm/trunk/include/llvm/Bitcode/BitstreamReader.h

Chris Lattner sabre at nondot.org
Sat Jan 19 15:31:15 PST 2013


Author: lattner
Date: Sat Jan 19 17:31:15 2013
New Revision: 172928

URL: http://llvm.org/viewvc/llvm-project?rev=172928&view=rev
Log:
add some optional flags to affect the way advance works.

Modified:
    llvm/trunk/include/llvm/Bitcode/BitstreamReader.h

Modified: llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamReader.h?rev=172928&r1=172927&r2=172928&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitstreamReader.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitstreamReader.h Sat Jan 19 17:31:15 2013
@@ -269,14 +269,19 @@
     return BitStream;
   }
 
+  /// Flags that modify the behavior of advance().
+  enum {
+    AF_DontPopBlockAtEnd = 1
+  };
   
   /// advance - Advance the current bitstream, returning the next entry in the
   /// stream.
-  BitstreamEntry advance() {
+  BitstreamEntry advance(unsigned Flags = 0) {
     while (1) {
       unsigned Code = ReadCode();
       if (Code == bitc::END_BLOCK) {
-        if (ReadBlockEnd())
+        // Pop the end of the block unless Flags tells us not to.
+        if (!(Flags & AF_DontPopBlockAtEnd) && ReadBlockEnd())
           return BitstreamEntry::getError();
         return BitstreamEntry::getEndBlock();
       }
@@ -297,10 +302,10 @@
 
   /// advanceSkippingSubblocks - This is a convenience function for clients that
   /// don't expect any subblocks.  This just skips over them automatically.
-  BitstreamEntry advanceSkippingSubblocks() {
+  BitstreamEntry advanceSkippingSubblocks(unsigned Flags = 0) {
     while (1) {
       // If we found a normal entry, return it.
-      BitstreamEntry Entry = advance();
+      BitstreamEntry Entry = advance(Flags);
       if (Entry.Kind != BitstreamEntry::SubBlock)
         return Entry;
       





More information about the llvm-commits mailing list