<div dir="ltr">That's fine with me.<div><br></div><div>Since an enumeration member has no corresponding QualType (there's only EnumConstantDecl), in order to put all the logic of enumerating enum members into QualASTType, QualASTType would have to be able to create instances of itself not directly backed by a QualType. I think probably the best way to go would be to have the TypeEnumMemberImpl that I'm writing recieve a reference to the QualASTType of the enum itself and the index of this enum member and either eagerly or lazily pull the relevant information out. What do you think?</div>

</div><div class="gmail_extra"><br clear="all"><div>--<br>Russell Harmon</div>
<br><br><div class="gmail_quote">On Tue, Oct 22, 2013 at 5:57 PM, Greg Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

How about SBTypeEnumMember? Everything in SBType.h currently starts with SBType.<br>
<div class="HOEnZb"><div class="h5"><br>
On Oct 22, 2013, at 3:53 PM, Russell Harmon <<a href="mailto:russ@eatnumber1.com">russ@eatnumber1.com</a>> wrote:<br>
<br>
> I had a full email saying why I disagree written when I convinced myself that I agree. My thinking is that an enum member is the only "type" (that I can think of) which is itself also a value. Anyway, I'm fine with what you've outlined, although the name SBTypeEnumerator is a bit confusing. How about SBValuedType or SBEnumTypeMember?<br>


><br>
> --<br>
> Russell Harmon<br>
><br>
><br>
> On Mon, Oct 14, 2013 at 10:45 AM, Enrico Granata <<a href="mailto:egranata@apple.com">egranata@apple.com</a>> wrote:<br>
> Russell,<br>
> I agree with Greg that this is a more sensible approach than hijacking SBTypeList for something that is not a type<br>
> If you want to go ahead and work in this area, you are most welcome to<br>
><br>
> Just a side note, since our SB objects are backed by one opaque-pointer type instance variable, it might make sense to define a TypeEnumeratorImpl class (and a corresponding TypeEnumeratorListImpl) much like SBType is backed by TypeImpl (technically, shared_ptr<TypeImpl>)<br>


> Having these classes in lldb-core would allow us to implement this functionality at the ClangASTType level and then just export it at the SB API level<br>
><br>
> What are your thoughts on this approach?<br>
><br>
> Enrico Granata<br>
> 📩 egranata@.com<br>
> ☎️ 27683<br>
><br>
> On Oct 14, 2013, at 10:22 AM, Greg Clayton <<a href="mailto:gclayton@apple.com">gclayton@apple.com</a>> wrote:<br>
><br>
>> An SBTypeList contains a list of SBType objects. It would not be very useful since SBType objects do not contain a values.<br>
>><br>
>> We should probably make an SBTypeEnumerator. Something like:<br>
>><br>
>><br>
>> class SBTypeEnumerator<br>
>> {<br>
>>      bool<br>
>>      IsSigned();<br>
>><br>
>>      // Get the enumerator value as a signed integer<br>
>>      int64_t<br>
>>      GetValueAsSigned();<br>
>><br>
>>      // Get the enumerator value as an unsigned integer<br>
>>        uint64_t<br>
>>      GetValueAsUnsigned();<br>
>><br>
>>      // Return the exact integer type for this enumerator<br>
>>      SBType<br>
>>      GetType();<br>
>><br>
>>      const char *<br>
>>      GetName();<br>
>> };<br>
>><br>
>> Then we would need to add a SBTypeEnumeratorList class as well:<br>
>><br>
>> class SBTypeEnumeratorList<br>
>> {<br>
>>      SBTypeEnumerator<br>
>>      GetEnumeratorAtIndex (uint32_t idx);<br>
>><br>
>>      SBTypeEnumerator<br>
>>      GetEnumeratorByName (const char *name);<br>
>><br>
>>      SBTypeEnumeratorList<br>
>>      GetEnumeratorsByValue (int64_t value);<br>
>><br>
>>      SBTypeEnumeratorList<br>
>>      GetEnumeratorsByValue (uint64_t value);<br>
>> };<br>
>><br>
>> Then we would need to add functions to SBType:<br>
>><br>
>> class SBType<br>
>> {<br>
>>      SBTypeEnumeratorList<br>
>>      GetEnumerators();<br>
>> }<br>
>><br>
>> This would return a valid SBTypeEnumeratorList only if the SBType it was run on is an enumeration type.<br>
>><br>
>><br>
>><br>
>> On Oct 13, 2013, at 5:14 PM, Russell Harmon <<a href="mailto:russ@eatnumber1.com">russ@eatnumber1.com</a>> wrote:<br>
>><br>
>>> According to the C11 standard, N1570, §6.7.2.2.3, "The identifiers in an enumerator list are declared as constants that have type int". Based on this, wouldn't it make most sense to have a function that returns an SBTypeList of ints?<br>


>>><br>
>>> Is there an easy work around for this missing bit of API, or shall I add the necessary pieces?<br>
>>><br>
>>> --<br>
>>> Russell Harmon<br>
>>><br>
>>><br>
>>> On Mon, Oct 7, 2013 at 10:45 AM, Enrico Granata <<a href="mailto:egranata@apple.com">egranata@apple.com</a>> wrote:<br>
>>> As far as I can tell/remember, this is missing API<br>
>>><br>
>>> Technically, it would not be an SBTypeList since the entries in an enumerator are *NOT* types.<br>
>>><br>
>>> We would probably have to come up with a new class like an SBEnumeratorEntry (I am sure better names are possible :-) that wraps the notion of a (numeric_value,string_name) pair<br>
>>><br>
>>> Enrico Granata<br>
>>> 📩 egranata@.com<br>
>>> ☎️ 27683<br>
>>><br>
>>> On Oct 7, 2013, at 12:23 AM, Russell Harmon <<a href="mailto:russ@eatnumber1.com">russ@eatnumber1.com</a>> wrote:<br>
>>><br>
>>>> Is there a way to enumerate the fields of an enum (e.x. get an SBTypeList from an enum), or is that missing API?<br>
>>>><br>
>>>> Thanks<br>
>>>> Russell Harmon<br>
>>>> _______________________________________________<br>
>>>> lldb-dev mailing list<br>
>>>> <a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>
>>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> lldb-dev mailing list<br>
>>> <a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>
>>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
>><br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>