Fix testing for end of stream in bitstream reader.
authorDerek Schuff <dschuff@google.com>
Mon, 3 Aug 2015 18:01:50 +0000 (18:01 +0000)
committerDerek Schuff <dschuff@google.com>
Mon, 3 Aug 2015 18:01:50 +0000 (18:01 +0000)
commitb4c1c28c6e1b8d9b7a1c6a9e62e46bb93bd3ef40
tree3ac2af2e1fa9ce7ca8d18107b93d73b384b6c4fc
parentac3a95f347f6f0780bf353d313a77e7a358f4864
Fix testing for end of stream in bitstream reader.

This fixes a bug found while working on the bitcode reader. In
particular, the method BitstreamReader::AtEndOfStream doesn't always
behave correctly when processing a data streamer. The method
fillCurWord doesn't properly set CurWord/BitsInCurWord if the data
streamer was already at eof, but GetBytes had not yet set the
ObjectSize field of the streaming memory object.

This patch fixes this problem, and provides a test to show that
this problem has been fixed.

Patch by Karl Schimpf.

Differential Revision: http://reviews.llvm.org/D11391

llvm-svn: 243890
llvm/include/llvm/Bitcode/BitstreamReader.h
llvm/include/llvm/Support/StreamingMemoryObject.h
llvm/test/Bitcode/Inputs/invalid-abbrev.bc
llvm/unittests/Bitcode/BitReaderTest.cpp