ashgti wrote:

Apparently rebasing my changes on a main caused GH to not let me reply to some 
comments directly (still learning GH's PR nuances...).

>From labath
> That probably fine, but I am pretty sure that being abstract doesn't prevent 
> you from [forming a reference](https://godbolt.org/z/Ejcxve5qq) to a class. 
> You must have tried to copy the object somewhere. The main advantage of a 
> reference is that it guarantees that the pointer is not null.

Should be fixed now, I thought I had tried this but I get a compiler error I 
misinterpreted as not being able to use a reference.

> Okay, I see what you're doing now. ReadUntil is reading the string one 
> character at a time, which means it can never read past the \r\n terminator. 
> Not particularly efficient, but I suppose it will do given that this just 
> needs to read a couple of bytes.

There is a slight optimization in `ReadUntil` that the first read will read up 
to the `delimiter`'s length first. But then its only reading 1 byte at a time 
until we get the size from the header.

> Another option would be to return an Expected<optional<Message>> with a 
> nullopt meaning "EOF". It's a bit of a mouthful, but we do have APIs like 
> that, and it doesn't look like this function will be used from that many 
> places.

Updated to use an `Expected<optional<Message>>` and I ended up making the only 
acceptable place to encounter an EOF is the start of a message header, 
otherwise we have a partial message that is error in the protocol.

https://github.com/llvm/llvm-project/pull/130026
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to