<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 10, 2016 at 6:47 AM, Rafael Espíndola <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"><span class="">>> 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 on<br>
> the success path.<br>
<br>
</span>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.</blockquote><div><br></div><div>Removes diagnostic handlers in other parts of LLVM (& Clang) - the IR 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 situations call for different tools (as I was saying yesterday on this thread). In some places a diagnostic handler is the right tool, and in some places error codes/results/etc are the right tool. We already live in that world & it seems like a reasonable one (there doesn't seem to be a fundamental conflict between our bool+std::string or error_code returns and existing diagnostic handlers - I think they can reasonably coexist in different parts of the codebase for different use cases)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> We were still not even<br>
done converting away from bool+std::string :-(<br>
<div class="HOEnZb"><div class="h5"><br>
Cheers,<br>
Rafael<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>
</div></div></blockquote></div><br></div></div>