r221804 - Use the return of readBytes to find out if we are at the end of the stream.

Jordan Rose jordan_rose at apple.com
Wed Nov 12 15:22:34 PST 2014


Looks like it's just this:

diff --git a/include/llvm/Bitcode/BitstreamReader.h b/include/llvm/Bitcode/BitstreamReader.h
index 6b9c858..41e50e1 100644
--- a/include/llvm/Bitcode/BitstreamReader.h
+++ b/include/llvm/Bitcode/BitstreamReader.h
@@ -227,7 +227,7 @@ public:
   bool AtEndOfStream() {
     if (BitsInCurWord != 0)
       return false;
-    if (Size == NextChar)
+    if (Size != 0 && Size == NextChar)
       return true;
     fillCurWord();
     return BitsInCurWord == 0;

i.e. you forgot about the fact that we /start/ with both Size and NextChar equal to 0. Does this look like the right fix to you?

Jordan


> On Nov 12, 2014, at 15:09, Jordan Rose <jordan_rose at apple.com> wrote:
> 
> Hi, Rafael. I think this commit broke our use of BitstreamReader in Swift. I'll poke at it a bit and see if I can figure out why before reverting.
> 
> Jordan





More information about the llvm-commits mailing list