diff options
author | Chris Lattner <sabre@nondot.org> | 2013-01-19 23:31:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2013-01-19 23:31:15 +0000 |
commit | 344fc23d23c969043f8f146b17cb7d2f47a98384 (patch) | |
tree | 16d79603455cf49de7cb6bb20fbc82fc68267509 /include/llvm/Bitcode | |
parent | 00a312c478771941bc3e98cfbe6728465c769807 (diff) |
add some optional flags to affect the way advance works.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172928 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Bitcode')
-rw-r--r-- | include/llvm/Bitcode/BitstreamReader.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/include/llvm/Bitcode/BitstreamReader.h b/include/llvm/Bitcode/BitstreamReader.h index 2ca92081e3..ae3d472c6b 100644 --- a/include/llvm/Bitcode/BitstreamReader.h +++ b/include/llvm/Bitcode/BitstreamReader.h @@ -269,14 +269,19 @@ public: 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 @@ public: /// 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; |