[lld] r221428 - [ELF] Use llvm::Twine

Shankar Easwaran shankare at codeaurora.org
Wed Nov 5 19:17:45 PST 2014


Committed in git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@221433

Thanks for your suggestion.

Shankar Easwaran


On 11/5/2014 9:00 PM, Shankar Easwaran wrote:
> Thanks David, Will give it a try.
>
> On 11/5/2014 8:32 PM, David Blaikie wrote:
>> (oops, forgot to reply-all)
>>
>> On Wed, Nov 5, 2014 at 6:32 PM, David Blaikie <dblaikie at gmail.com> 
>> wrote:
>>
>>>
>>> On Wed, Nov 5, 2014 at 6:03 PM, Shankar Easwaran <shankarke at gmail.com>
>>> wrote:
>>>
>>>> Author: shankare
>>>> Date: Wed Nov  5 20:03:40 2014
>>>> New Revision: 221428
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=221428&view=rev
>>>> Log:
>>>> [ELF] Use llvm::Twine
>>>>
>>>> Modified:
>>>>      lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h
>>>>
>>>> Modified: lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h
>>>> URL:
>>>> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h?rev=221428&r1=221427&r2=221428&view=diff 
>>>>
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h (original)
>>>> +++ lld/trunk/lib/ReaderWriter/ELF/ExecutableWriter.h Wed Nov  5 
>>>> 20:03:40
>>>> 2014
>>>> @@ -130,12 +130,8 @@ template <class ELFT> void ExecutableWri
>>>>     auto endAtomIter = this->_layout.findAbsoluteAtom("end");
>>>>
>>>>     auto startEnd = [&](StringRef sym, StringRef sec) -> void {
>>>> -    // TODO: This looks like a good place to use Twine...
>>>> -    std::string start("__"), end("__");
>>>> -    start += sym;
>>>> -    start += "_start";
>>>> -    end += sym;
>>>> -    end += "_end";
>>>> +    std::string start = (llvm::Twine("__", sym) + "_start").str();
>>>> +    std::string end = (llvm::Twine("__", sym) + "_end").str();
>>>>
>>> Do you need the "Twine(" at all? I think const char * + StringRef -> 
>>> Twine
>>> implicitly:
>>>
>>> "__" + sym + "_end"
>>>
>>> If that doesn't work, usually we just explicitly convert the first 
>>> operand
>>> to Twine:
>>>
>>> Twine("__") + sym + "_end"
>>>
>>> rather than using Twine's concatenation operations directly.
>>>
>>>
>>>>       auto s = this->_layout.findAbsoluteAtom(start);
>>>>       auto e = this->_layout.findAbsoluteAtom(end);
>>>>       auto section = this->_layout.findOutputSection(sec);
>>>>
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>>
>>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141105/cf6f0ca2/attachment.html>


More information about the llvm-commits mailing list