[llvm] r224953 - Remove unnecessary StringRef->std::string conversion.
Alexey Samsonov
vonosmas at gmail.com
Mon Dec 29 13:37:47 PST 2014
On Mon, Dec 29, 2014 at 1:07 PM, Chandler Carruth <chandlerc at google.com>
wrote:
>
> On Mon, Dec 29, 2014 at 12:59 PM, Alexey Samsonov <vonosmas at gmail.com>
> wrote:
>
>> Author: samsonov
>> Date: Mon Dec 29 14:59:02 2014
>> New Revision: 224953
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=224953&view=rev
>> Log:
>> Remove unnecessary StringRef->std::string conversion.
>>
>> Modified:
>> llvm/trunk/lib/Support/Unix/Path.inc
>>
>> Modified: llvm/trunk/lib/Support/Unix/Path.inc
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=224953&r1=224952&r2=224953&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/Support/Unix/Path.inc (original)
>> +++ llvm/trunk/lib/Support/Unix/Path.inc Mon Dec 29 14:59:02 2014
>> @@ -150,7 +150,7 @@ std::string getMainExecutable(const char
>> // /proc is not always mounted under Linux (chroot for example).
>> ssize_t len = readlink(aPath.str().c_str(), exe_path,
>> sizeof(exe_path));
>> if (len >= 0)
>> - return StringRef(exe_path, len);
>> + return std::string(exe_path, len);
>>
>
> Are you sure RVO can fire here? If not, this adds a std::string copy....
>
Implementation of StringRef -> std::string() conversion overaptor calls the
same std::string(Data, Length) constructor.
--
Alexey Samsonov
vonosmas at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141229/c6f6aebb/attachment.html>
More information about the llvm-commits
mailing list