<div dir="ltr">ErrorOr still exists, and generally useful. This proposal introduces a similar class, TypedErrorOr, that replaces the std::error_code with a TypedError.<div><br></div><div>Any more detailed discussion of ErrorOr usage should probably happen on another thread - this one is already getting long. :)<div><br></div><div>- Lang.</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 10, 2016 at 8:44 AM, Paweł Bylica <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Sorry for the question out of nowhere, but what happened to ErrorOr<> scheme?</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Feb 10, 2016 at 5:41 PM Rafael Espíndola <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">On 10 February 2016 at 11:10, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br>
><br>
><br>
> On Wed, Feb 10, 2016 at 6:47 AM, Rafael Espíndola <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br>
> wrote:<br>
>><br>
>> >> This highlights why I think it is important to keep diagnostics and<br>
>> >> errors separate. In the solution you have there is a need to allocate<br>
>> >> a std::string, even if that is never used.<br>
>> ><br>
>> > Errors are only constructed on the error path. There is no construction<br>
>> > on<br>
>> > the success path.<br>
>><br>
>> But they are always created, even if it as error the caller wants to<br>
>> ignore. For example, you will always create a "file foo.o in bar.a is<br>
>> not a bitcode" message (or copy sufficient information for that to be<br>
>> created). With a dignostic handler no copying is needed, since the<br>
>> call happens in the context where the error is found. It is easy to<br>
>> see us in a position where a lot of context is copied because some<br>
>> client somewhere might want it.<br>
>><br>
>> So I am worried we are coding for the hypothetical and adding<br>
>> complexity. In particular, if we are going this way I think it is<br>
>> critical that your patch *removes* the existing diagnostic handlers<br>
>> (while making sure test/Bitcode/invalid.ll still passes) so that we<br>
>> don't end up with two overlapping solutions.<br>
><br>
><br>
> Removes diagnostic handlers in other parts of LLVM (& Clang) - the IR<br>
> verifier's diagnostic handling is what you're referring to here ^?<br>
><br>
> I don't think that would be an improvement - it seems like different<br>
> situations call for different tools (as I was saying yesterday on this<br>
> thread). In some places a diagnostic handler is the right tool, and in some<br>
> places error codes/results/etc are the right tool. We already live in that<br>
> world & it seems like a reasonable one (there doesn't seem to be a<br>
> fundamental conflict between our bool+std::string or error_code returns and<br>
> existing diagnostic handlers - I think they can reasonably coexist in<br>
> different parts of the codebase for different use cases)<br>
<br></div></div>
In which case we do need a plain checked error_code. Right now we use<br>
a diagnostic handler in the BitcodeReader, but it is really easy to<br>
miss propagating an error out. We shouldn't be in a position where we<br>
have to decide to use an diagnostic handler or have checked errors. It<br>
should be possible to have both if it is not desired that the new<br>
error handling replaces the use of diagnostic handling.<span class=""><br>
<br>
Cheers,<br>
Rafael<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</span></blockquote></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>