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

Zachary Turner zturner at google.com
Mon Feb 23 08:01:53 PST 2015


No we don't. A const char* is not guaranteed to be null terminated either.
Its up to you to make sure you pass it a null terminated string. Same
applies here.
On Mon, Feb 23, 2015 at 1:41 AM Pavel Labath <labath at google.com> wrote:

>
> On 20 February 2015 at 19:46, Enrico Granata <egranata at apple.com> wrote:
>
>> +Error
>> +OptionValueLanguage::SetValueFromString (llvm::StringRef value,
>> VarSetOperationType op)
>> +{
>> +    Error error;
>> +    switch (op)
>> +    {
>> +    case eVarSetOperationClear:
>> +        Clear();
>> +        break;
>> +
>> +    case eVarSetOperationReplace:
>> +    case eVarSetOperationAssign:
>> +        {
>> +            LanguageType new_type =
>> LanguageRuntime::GetLanguageTypeFromString(value.data());
>>
>
> Hi,
>
> llvm::StringRef::data() is not guaranteed to return a null terminated
> string. We would need to call value.str().c_str() here, or (even better)
> fix the receiver to operate on llvm::StringRef as well.
>
> cheers,
> pl
> _______________________________________________
> 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/3a6856f1/attachment.html>


More information about the lldb-commits mailing list