llvm.org GIT mirror llvm / d0ad0eb
Change BitstreamCursor::skipRecord to return the record code (NFC) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291026 91177308-0d34-0410-b5e6-96231b3b80d8 Mehdi Amini 3 years ago
2 changed file(s) with 17 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
476476 return CurAbbrevs[AbbrevNo].get();
477477 }
478478
479 /// Read the current record and discard it.
480 void skipRecord(unsigned AbbrevID);
479 /// Read the current record and discard it, returning the code for the record.
480 unsigned skipRecord(unsigned AbbrevID);
481481
482482 unsigned readRecord(unsigned AbbrevID, SmallVectorImpl &Vals,
483483 StringRef *Blob = nullptr);
9292 }
9393
9494 /// skipRecord - Read the current record and discard it.
95 void BitstreamCursor::skipRecord(unsigned AbbrevID) {
95 unsigned BitstreamCursor::skipRecord(unsigned AbbrevID) {
9696 // Skip unabbreviated records by reading past their entries.
9797 if (AbbrevID == bitc::UNABBREV_RECORD) {
9898 unsigned Code = ReadVBR(6);
99 (void)Code;
10099 unsigned NumElts = ReadVBR(6);
101100 for (unsigned i = 0; i != NumElts; ++i)
102101 (void)ReadVBR64(6);
103 return;
102 return Code;
104103 }
105104
106105 const BitCodeAbbrev *Abbv = getAbbrev(AbbrevID);
107
108 for (unsigned i = 0, e = Abbv->getNumOperandInfos(); i != e; ++i) {
106 const BitCodeAbbrevOp &CodeOp = Abbv->getOperandInfo(0);
107 unsigned Code;
108 if (CodeOp.isLiteral())
109 Code = CodeOp.getLiteralValue();
110 else {
111 if (CodeOp.getEncoding() == BitCodeAbbrevOp::Array ||
112 CodeOp.getEncoding() == BitCodeAbbrevOp::Blob)
113 report_fatal_error("Abbreviation starts with an Array or a Blob");
114 Code = readAbbreviatedField(*this, CodeOp);
115 }
116
117 for (unsigned i = 1, e = Abbv->getNumOperandInfos(); i < e; ++i) {
109118 const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i);
110119 if (Op.isLiteral())
111120 continue;
163172 // Skip over the blob.
164173 JumpToBit(NewEnd);
165174 }
175 return Code;
166176 }
167177
168178 unsigned BitstreamCursor::readRecord(unsigned AbbrevID,