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

Pavel Labath labath at google.com
Mon Feb 23 01:40:10 PST 2015


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150223/56a7a7d2/attachment.html>


More information about the lldb-commits mailing list