summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Bitcode/BitstreamReaderTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Explicitly test BitstreamReader::setArtificialByteLimit, NFCDuncan P. N. Exon Smith2016-03-281-1/+7
| | | | | | | | | | | Explicitly check that artificial byte limit is rounded correctly by exposing BitstreamReader::Size through a new accessor, getSizeIfKnown. The original code for rounding (from r264547) wasn't obviously correct, and even though r264623 cleaned it up (by calling llvm::alignTo) I think it's worth testing. llvm-svn: 264650
* Remove accidentally duplicated testDuncan P. N. Exon Smith2016-03-281-13/+0
| | | | | | This was identical to setArtificialByteLimitNotWordBoundary. llvm-svn: 264646
* Bitcode: Fix MSVC bot failure from r264549Duncan P. N. Exon Smith2016-03-271-2/+3
| | | | | | make_unique => llvm::make_unique llvm-svn: 264553
* Support: Implement StreamingMemoryObject::getPointerDuncan P. N. Exon Smith2016-03-271-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation is fairly obvious. This is preparation for using some blobs in bitcode. For clarity (and perhaps future-proofing?), I moved the call to JumpToBit in BitstreamCursor::readRecord ahead of calling MemoryObject::getPointer, since JumpToBit can theoretically (a) read bytes, which (b) invalidates the blob pointer. This isn't strictly necessary the two memory objects we have: - The return of RawMemoryObject::getPointer is valid until the memory object is destroyed. - StreamingMemoryObject::getPointer is valid until the next chunk is read from the stream. Since the JumpToBit call is only going ahead to a word boundary, we'll never load another chunk. However, reordering makes it clear by inspection that the blob returned by BitstreamCursor::readRecord will be valid. I added some tests for StreamingMemoryObject::getPointer and BitstreamCursor::readRecord. llvm-svn: 264549
* Bitcode: Add SimpleBitstreamCursor::setArtificialByteLimitDuncan P. N. Exon Smith2016-03-271-0/+69
| | | | | | | | | Allow users of SimpleBitstreamCursor to limit the number of bytes available to the cursor. This is preparation for instantiating a cursor that isn't allowed to load more bytes from a StreamingMemoryObject (just move around the ones already-loaded). llvm-svn: 264547
* Bitcode: Add SimpleBitstreamCursor::getPointerToByte, etc.Duncan P. N. Exon Smith2016-03-271-0/+43
| | | | | | | | | | | | | | | Add API to SimpleBitstreamCursor to allow users to translate between byte addresses and pointers. - jumpToPointer: move the bit position to a particular pointer. - getPointerToByte: get the pointer for a particular byte. - getPointerToBit: get the pointer for the byte of the current bit. - getCurrentByteNo: convenience function for assertions and tests. Mainly adds unit tests (getPointerToBit/Byte already has a use), but also preparation for eventually using jumpToPointer. llvm-svn: 264546
* [Bitcode] AtEndOfStream should only check against the size if it's known.Jordan Rose2014-11-131-0/+56
This avoids an issue where AtEndOfStream mistakenly returns true at the /start/ of a stream. (In the rare case that the size is known and actually 0, the slow path will still handle it correctly.) llvm-svn: 221840
OpenPOWER on IntegriCloud