<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 29, 2014 at 1:07 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><span class=""><br><div class="gmail_quote">On Mon, Dec 29, 2014 at 12:59 PM, Alexey Samsonov <span dir="ltr"><<a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="overflow:hidden">Author: samsonov<br>
Date: Mon Dec 29 14:59:02 2014<br>
New Revision: 224953<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=224953&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=224953&view=rev</a><br>
Log:<br>
Remove unnecessary StringRef->std::string conversion.<br>
<br>
Modified:<br>
llvm/trunk/lib/Support/Unix/Path.inc<br>
<br>
Modified: llvm/trunk/lib/Support/Unix/Path.inc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=224953&r1=224952&r2=224953&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=224953&r1=224952&r2=224953&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/Unix/Path.inc (original)<br>
+++ llvm/trunk/lib/Support/Unix/Path.inc Mon Dec 29 14:59:02 2014<br>
@@ -150,7 +150,7 @@ std::string getMainExecutable(const char<br>
// /proc is not always mounted under Linux (chroot for example).<br>
ssize_t len = readlink(aPath.str().c_str(), exe_path, sizeof(exe_path));<br>
if (len >= 0)<br>
- return StringRef(exe_path, len);<br>
+ return std::string(exe_path, len);</div></blockquote></div><br></span>Are you sure RVO can fire here? If not, this adds a std::string copy....</div></div></blockquote><div><br>At best it should add an extra move (guaranteed), but I believe RVO would fire - my naive understanding is that if at the time the return value is constructed, it's guaranteed to be the return value (all paths from the construction return that object) then (N)RVO can fire. I'm not sure of what cases where non-named RVO would not fire, really... so perhaps I'm missing something.<br><br>- David<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div></div></div>