jimingham wrote:

I'm not sure I like this.  

ValueObjects carry error information with them.  Adding the error return in the 
Expected means there are now two places you should put the error, in the 
Expected, and in the VO you returned.  After all, some time later the code 
might want to know the state of this VO, and would be right to expect that to 
be in the return of ValueObject::GetError().

The problem is the case where you might return a ValueObjectSP that is empty 
because of an error, rather than returning an error bearing ValueObject in the 
Shared Pointer.  One solution is to enforce as "coding policy" that anything 
that returns a ValueObjectSP when there was an error producing the VO HAS to 
return a VO with the error set, not an empty ValueObjectSP.  We've been trying 
to be more consistent about doing that.

It would be cool if we had some kind of "guaranteed not to be empty 
ValueObectSP return type" that could enforce this convention, but for now, I 
think it's better to be consistent about enforcing the VO natural error passing 
and treat empty SP returns as "<unknown error>".

https://github.com/llvm/llvm-project/pull/217431
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to