mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-23 17:24:48 +00:00
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
This commit is contained in:
@ -269,14 +269,19 @@ public:
|
|||||||
return BitStream;
|
return BitStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Flags that modify the behavior of advance().
|
||||||
|
enum {
|
||||||
|
AF_DontPopBlockAtEnd = 1
|
||||||
|
};
|
||||||
|
|
||||||
/// advance - Advance the current bitstream, returning the next entry in the
|
/// advance - Advance the current bitstream, returning the next entry in the
|
||||||
/// stream.
|
/// stream.
|
||||||
BitstreamEntry advance() {
|
BitstreamEntry advance(unsigned Flags = 0) {
|
||||||
while (1) {
|
while (1) {
|
||||||
unsigned Code = ReadCode();
|
unsigned Code = ReadCode();
|
||||||
if (Code == bitc::END_BLOCK) {
|
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::getError();
|
||||||
return BitstreamEntry::getEndBlock();
|
return BitstreamEntry::getEndBlock();
|
||||||
}
|
}
|
||||||
@ -297,10 +302,10 @@ public:
|
|||||||
|
|
||||||
/// advanceSkippingSubblocks - This is a convenience function for clients that
|
/// advanceSkippingSubblocks - This is a convenience function for clients that
|
||||||
/// don't expect any subblocks. This just skips over them automatically.
|
/// don't expect any subblocks. This just skips over them automatically.
|
||||||
BitstreamEntry advanceSkippingSubblocks() {
|
BitstreamEntry advanceSkippingSubblocks(unsigned Flags = 0) {
|
||||||
while (1) {
|
while (1) {
|
||||||
// If we found a normal entry, return it.
|
// If we found a normal entry, return it.
|
||||||
BitstreamEntry Entry = advance();
|
BitstreamEntry Entry = advance(Flags);
|
||||||
if (Entry.Kind != BitstreamEntry::SubBlock)
|
if (Entry.Kind != BitstreamEntry::SubBlock)
|
||||||
return Entry;
|
return Entry;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user