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

Rafael Avila de Espindola rafael.espindola at gmail.com
Wed Nov 12 15:38:56 PST 2014



Sent from my iPhone

> On Nov 12, 2014, at 18:22, Jordan Rose <jordan_rose at apple.com> wrote:
> 
> 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?


Oh, so a call at the very start would fail. LGTM
> 
> 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