On Oct 18, 2010, at 8:54 AM, Arvid Ephraim Picciani wrote:

> On 09/23/2010 11:16 PM, ext Greg Clayton wrote:
>> It currently isn't in there, though it could easily be added. We should 
>> probably add it as:
>> 
>> class SBValue {
>> ...
>> 
>>      SBValue Cast (SBType type);
>> };
>> 
> 
> tried doing that, unfortunately SBType is not actually a lldb_private::Type, 
> so i don't see  how i should use as actual type in Value.  This whole clang 
> AST stuff is just magic to me, and i dont know what to do with it in the 
> context of casting.

The SBType and SBTypeList stuff hasn't really been fleshed out or used a lot 
yet and it does need some work. 

The idea would be (and this is not how it currently is) is you would search for 
types by name:

SBValue value = ...
SBTarget target ...
SBTypeList type_list;
uint32_t max_matches = 1;
size_t n = target.FindTypes ("size_t", type_list, max_matches);

if (n)
{
    SBType sb_type (type_list.GetTypeAtIndex (0));
    value.Cast (sb_type);
}

After looking at the code, nothing is really trying to return or fill in 
anything valid in the SBType and SBTypeList classes.

Like you said, I need to make SBType backed by a lldb::TypeSP like all the 
other classes.

The clang type system is large and complex, but the nice thing is with just an 
AST pointer and a type pointer (which is an opaque pointer that can be turned 
back into a clang::QualType), we can get all of the information out of a type:
- name
- size
- alignment
- num children
- what the type of each of the children are
- much more






_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

Reply via email to