[Lldb-commits] [lldb] r230046 - Add an OptionValueLanguage class

Zachary Turner zturner at google.com
Mon Feb 23 14:23:11 PST 2015


FWIW Pavel's original suggestion (which I missed in my original response)
appears pretty easy to do.  All the called function does is to do a case
insensitive string compare, which StringRef contains a method for.  So it
seems easy to change that function to take a StringRef, which is better
than any of the other suggestions proposed anyway.

On Mon Feb 23 2015 at 2:16:57 PM Vince Harron <vharron at google.com> wrote:

> Hi all,
>
> We can't assume StringRef is null terminated, ever.
>
> Vince
>  On Feb 23, 2015 4:48 PM, "Joerg Sonnenberger" <joerg at britannica.bec.de>
> wrote:
>
>> On Mon, Feb 23, 2015 at 05:31:50PM +0000, Zachary Turner wrote:
>> > How so? Suppose you've got a function which takes a const char*.
>> Obviously
>> > it's null terminated or your function wouldn't be able to work. If you
>> > replace that with a StringRef it's still null terminated because the
>> call
>> > site hasn't changed. Either way, its up to the caller to pass something
>> > null terminated.
>> >
>> > Any time you construct a StringRef from a std::string or ConstString,
>> which
>> > is very close to 100% of what we do, the StringRef is guaranteed to be
>> null
>> > terminated.
>>
>> But StringRef is normally a part of either a std::string or const char *.
>> While there might be a null byte somewhere, it has no relation to the
>> size of the string referenced by StringRef. The point is that accessing
>> the data of a StringRef doesn't give a null terminated string of the
>> same size as the StringRef, if at all.
>>
>> Joerg
>>
> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150223/fe3d250d/attachment.html>


More information about the lldb-commits mailing list