/// skipRecord - Read the current record and discard it.
void skipRecord(unsigned AbbrevID);
+ unsigned readRecord(unsigned AbbrevID, SmallVectorImpl<uint64_t> &Vals,
+ StringRef *Blob = 0);
+
unsigned ReadRecord(unsigned AbbrevID, SmallVectorImpl<uint64_t> &Vals,
- const char **BlobStart = 0, unsigned *BlobLen = 0);
-
+ const char **BlobStart = 0, unsigned *BlobLen = 0) {
+ if (!BlobStart)
+ return readRecord(AbbrevID, Vals);
+ StringRef S;
+ unsigned X = readRecord(AbbrevID, Vals, &S);
+ *BlobStart = S.data();
+ *BlobLen = S.size();
+ return X;
+ }
+
unsigned ReadRecord(unsigned AbbrevID, SmallVectorImpl<uint64_t> &Vals,
const char *&BlobStart, unsigned &BlobLen) {
return ReadRecord(AbbrevID, Vals, &BlobStart, &BlobLen);
}
}
-unsigned BitstreamCursor::ReadRecord(unsigned AbbrevID,
+unsigned BitstreamCursor::readRecord(unsigned AbbrevID,
SmallVectorImpl<uint64_t> &Vals,
- const char **BlobStart, unsigned *BlobLen){
+ StringRef *Blob) {
if (AbbrevID == bitc::UNABBREV_RECORD) {
unsigned Code = ReadVBR(6);
unsigned NumElts = ReadVBR(6);
// Otherwise, read the number of bytes. If we can return a reference to
// the data, do so to avoid copying it.
- if (BlobStart) {
- *BlobStart = (const char*)BitStream->getBitcodeBytes().getPointer(
- NextChar, NumElts);
- *BlobLen = NumElts;
+ if (Blob) {
+ *Blob =
+ StringRef((const char*)BitStream->getBitcodeBytes().getPointer(
+ NextChar, NumElts),
+ NumElts);
} else {
for (; NumElts; ++NextChar, --NumElts)
Vals.push_back(getByte(NextChar));