[Lldb-commits] [lldb] r219423 - Add an API on ValueObject to retrieve the desired dynamic/synthetic combination all at once, if available, working somewhat hard to avoid returning an invalid ValueObject in the process

Enrico Granata egranata at apple.com
Fri Oct 10 17:16:13 PDT 2014


Fair enough.. I guess I would feel better if our enums were enum classes, but yeah, good change, no objection! :)

> On Oct 10, 2014, at 5:11 PM, Eric Christopher <echristo at gmail.com> wrote:
> 
> On Thu, Oct 9, 2014 at 11:24 AM, Enrico Granata <egranata at apple.com <mailto:egranata at apple.com>> wrote:
>> Author: enrico
>> Date: Thu Oct  9 13:24:30 2014
>> New Revision: 219423
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=219423&view=rev
>> Log:
>> Add an API on ValueObject to retrieve the desired dynamic/synthetic combination all at once, if available, working somewhat hard to avoid returning an invalid ValueObject in the process
>> 
>> Modified:
>>    lldb/trunk/include/lldb/Core/ValueObject.h
>>    lldb/trunk/source/Core/ValueObject.cpp
>> 
>> Modified: lldb/trunk/include/lldb/Core/ValueObject.h
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=219423&r1=219422&r2=219423&view=diff
>> ==============================================================================
>> --- lldb/trunk/include/lldb/Core/ValueObject.h (original)
>> +++ lldb/trunk/include/lldb/Core/ValueObject.h Thu Oct  9 13:24:30 2014
>> @@ -708,6 +708,10 @@ public:
>>     virtual bool
>>     IsSynthetic() { return false; }
>> 
>> +    lldb::ValueObjectSP
>> +    GetQualifiedRepresentationIfAvailable (lldb::DynamicValueType dynValue,
>> +                                           bool synthValue);
>> +
>>     virtual lldb::ValueObjectSP
>>     CreateConstantValue (const ConstString &name);
>> 
>> 
>> Modified: lldb/trunk/source/Core/ValueObject.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=219423&r1=219422&r2=219423&view=diff
>> ==============================================================================
>> --- lldb/trunk/source/Core/ValueObject.cpp (original)
>> +++ lldb/trunk/source/Core/ValueObject.cpp Thu Oct  9 13:24:30 2014
>> @@ -3551,6 +3551,56 @@ ValueObject::CreateConstantValue (const
>>     return valobj_sp;
>> }
>> 
>> +ValueObjectSP
>> +ValueObject::GetQualifiedRepresentationIfAvailable (lldb::DynamicValueType dynValue,
>> +                                                    bool synthValue)
>> +{
>> +    ValueObjectSP result_sp(GetSP());
>> +
>> +    switch (dynValue)
>> +    {
>> +        case lldb::eDynamicCanRunTarget:
>> +        case lldb::eDynamicDontRunTarget:
>> +        {
>> +            if (!result_sp->IsDynamic())
>> +            {
>> +                if (result_sp->GetDynamicValue(dynValue))
>> +                    result_sp = result_sp->GetDynamicValue(dynValue);
>> +            }
>> +        }
>> +            break;
>> +        case lldb::eNoDynamicValues:
>> +        default:
> 
> This was triggering the warning on a default case in a fully covered
> switch. I removed it in:
> 
> dzur:~/sources/llvm/tools/lldb> svn ci source/Core/ValueObject.cpp
> Sending        source/Core/ValueObject.cpp
> Transmitting file data .
> Committed revision 219548.
> 
> -eric
> 
> 
>> +        {
>> +            if (result_sp->IsDynamic())
>> +            {
>> +                if (result_sp->GetStaticValue())
>> +                    result_sp = result_sp->GetStaticValue();
>> +            }
>> +        }
>> +            break;
>> +    }
>> +
>> +    if (synthValue)
>> +    {
>> +        if (!result_sp->IsSynthetic())
>> +        {
>> +            if (result_sp->GetSyntheticValue())
>> +                result_sp = result_sp->GetSyntheticValue();
>> +        }
>> +    }
>> +    else
>> +    {
>> +        if (result_sp->IsSynthetic())
>> +        {
>> +            if (result_sp->GetNonSyntheticValue())
>> +                result_sp = result_sp->GetNonSyntheticValue();
>> +        }
>> +    }
>> +
>> +    return result_sp;
>> +}
>> +
>> lldb::addr_t
>> ValueObject::GetCPPVTableAddress (AddressType &address_type)
>> {
>> 
>> 
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Thanks,
- Enrico
📩 egranata@.com ☎️ 27683




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20141010/02b9bce6/attachment.html>


More information about the lldb-commits mailing list