convert the bitstream reader itself and the IR .bc file parser to use the new advance() APIs,

simplifying things and making a bunch of details more private to BitstreamCursor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172947 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2013-01-20 02:13:19 +00:00
parent 099b636562
commit 5a4251c767
2 changed files with 214 additions and 248 deletions

View File

@ -306,17 +306,21 @@ bool BitstreamCursor::ReadBlockInfoBlock() {
// Read all the records for this module.
while (1) {
unsigned Code = ReadCode();
if (Code == bitc::END_BLOCK)
return ReadBlockEnd();
if (Code == bitc::ENTER_SUBBLOCK) {
ReadSubBlockID();
if (SkipBlock()) return true;
continue;
}
BitstreamEntry Entry = advanceSkippingSubblocks(AF_DontAutoprocessAbbrevs);
switch (Entry.Kind) {
case llvm::BitstreamEntry::SubBlock: // Handled for us already.
case llvm::BitstreamEntry::Error:
return true;
case llvm::BitstreamEntry::EndBlock:
return false;
case llvm::BitstreamEntry::Record:
// The interesting case.
break;
}
// Read abbrev records, associate them with CurBID.
if (Code == bitc::DEFINE_ABBREV) {
if (Entry.ID == bitc::DEFINE_ABBREV) {
if (!CurBlockInfo) return true;
ReadAbbrevRecord();
@ -330,7 +334,7 @@ bool BitstreamCursor::ReadBlockInfoBlock() {
// Read a record.
Record.clear();
switch (ReadRecord(Code, Record)) {
switch (readRecord(Entry.ID, Record)) {
default: break; // Default behavior, ignore unknown content.
case bitc::BLOCKINFO_CODE_SETBID:
if (Record.size() < 1) return true;