diff options
Diffstat (limited to 'lib/Bitcode/Reader/BitstreamReader.cpp')
-rw-r--r-- | lib/Bitcode/Reader/BitstreamReader.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Bitcode/Reader/BitstreamReader.cpp b/lib/Bitcode/Reader/BitstreamReader.cpp index 92133bb969..7984512b4b 100644 --- a/lib/Bitcode/Reader/BitstreamReader.cpp +++ b/lib/Bitcode/Reader/BitstreamReader.cpp @@ -255,18 +255,17 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID, break; } - // Otherwise, read the number of bytes. If we can return a reference to - // the data, do so to avoid copying it. + // Otherwise, inform the streamer that we need these bytes in memory. + const char *Ptr = (const char*) + BitStream->getBitcodeBytes().getPointer(CurBitPos/8, NumElts); + + // If we can return a reference to the data, do so to avoid copying it. if (Blob) { - *Blob = - StringRef((const char*)BitStream->getBitcodeBytes().getPointer( - CurBitPos/8, NumElts), - NumElts); + *Blob = StringRef(Ptr, NumElts); } else { - // FIXME: This is a brutally inefficient way to do this. Why isn't this - // just using getPointer? + // Otherwise, unpack into Vals with zero extension. for (; NumElts; --NumElts) - Vals.push_back(Read(8)); + Vals.push_back((unsigned char)*Ptr++); } // Skip over tail padding. JumpToBit(NewEnd); |