<div dir="ltr">Yeah, I was just looking into Optional (didn't see your reply until just now), and I do think it's a better option, so to speak. I think you have it right, most callers call it on a specific intrinsic that they know should be available. And then in a few cases it probes to see if a particular libcall or which of set of libcalls is available and has a fallback.</div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jul 21, 2017 at 10:15 AM David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Jul 21, 2017 at 10:10 AM Derek Schuff via Phabricator <<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">dschuff added a comment.<br>
<br>
Actually, maybe an even better idea:<br>
`getLibcallName()` returns a StringRef and asserts rather than returning a failure code. `getLIbcallNameIfAvailable()` returns an Expected<StringRef> and can fail.<br></blockquote></div></div><div dir="ltr"><div class="gmail_quote"><div><br>Probably still Optional<StringRef>, I would imagine - it doesn't have quite the 'security' of Expected<StringRef>, but there's not likely any Error that really needs to/can be communicated here, merely the absence of a result.<br> </div></div></div><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The former matches  90% of the existing uses. This would let us move away from char* for the external symbol APIs (assuming that's a good thing) but most of the existing uses wouldn't need to actually change, and those that check failure would still be simple.<br></blockquote></div></div><div dir="ltr"><div class="gmail_quote"><div><br>Why do so many users effectively assert on the name? There's a particular condition/context that they call it on that means they'll never be calling it on one of these libcalls that doesn't have a name?<br><br>- Dave<br> </div></div></div><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D35522" rel="noreferrer" target="_blank">https://reviews.llvm.org/D35522</a><br>
<br>
<br>
<br>
</blockquote></div></div></blockquote></div>