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)
commitf96e27f256cc922633b1ff8c13a61b3ff28ae7e1
tree5337d1fe8900185292d240680a34e8f9b57fb461
parent5027260ce6d222ea3bae2057a483862919bf3490
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243890 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Bitcode/BitstreamReader.h
include/llvm/Support/StreamingMemoryObject.h
test/Bitcode/Inputs/invalid-abbrev.bc
unittests/Bitcode/BitReaderTest.cpp