<div dir="ltr">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?</div>

<div class="gmail_extra"><br clear="all"><div>--<br>Russell Harmon</div>
<br><br><div class="gmail_quote">On Mon, Oct 14, 2013 at 10:45 AM, Enrico Granata <span dir="ltr"><<a href="mailto:egranata@apple.com" target="_blank">egranata@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div style="word-wrap:break-word">Russell,<div>I agree with Greg that this is a more sensible approach than hijacking SBTypeList for something that is not a type</div><div>If you want to go ahead and work in this area, you are most welcome to</div>

<div><br></div><div>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>)</div>

<div>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</div><div><br></div><div>What are your thoughts on this approach?</div>

<div><div><div class="im"><br><div>
<div style="text-indent:0px;letter-spacing:normal;text-align:start;text-transform:none;white-space:normal;word-wrap:break-word;word-spacing:0px"><div style="text-indent:0px;letter-spacing:normal;text-align:start;text-transform:none;white-space:normal;word-wrap:break-word;word-spacing:0px">

<div style="border-collapse:separate;border-spacing:0px"><span style="font-size:12px">Enrico Granata</span><br style="font-size:12px"><span style="font-size:12px">📩 egranata@</span><font color="#ff2600" style="font-size:12px"></font><span style="font-size:12px">.com</span><br style="font-size:12px">

<span style="font-size:12px">☎️ 27683</span></div></div></div>
</div>
<br></div><div><div class="h5"><div><div>On Oct 14, 2013, at 10:22 AM, Greg Clayton <<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>> wrote:</div><br><blockquote type="cite">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><span style="white-space:pre-wrap">      </span>bool<br><span style="white-space:pre-wrap">  </span>IsSigned();<br><span style="white-space:pre-wrap">   </span><br>

<span style="white-space:pre-wrap">     </span>// Get the enumerator value as a signed integer<br><span style="white-space:pre-wrap">       </span>int64_t<br><span style="white-space:pre-wrap">       </span>GetValueAsSigned();<br><br><span style="white-space:pre-wrap"> </span>// Get the enumerator value as an unsigned integer<br>

        uint64_t<br><span style="white-space:pre-wrap">    </span>GetValueAsUnsigned();<br><br><span style="white-space:pre-wrap">       </span>// Return the exact integer type for this enumerator<br><span style="white-space:pre-wrap">  </span>SBType<br>

<span style="white-space:pre-wrap">     </span>GetType();<br><br><span style="white-space:pre-wrap">  </span>const char *<br><span style="white-space:pre-wrap">  </span>GetName();<br>};<br><br>Then we would need to add a SBTypeEnumeratorList class as well:<br>

<br>class SBTypeEnumeratorList <br>{<br><span style="white-space:pre-wrap">   </span>SBTypeEnumerator<br><span style="white-space:pre-wrap">      </span>GetEnumeratorAtIndex (uint32_t idx);<br><br><span style="white-space:pre-wrap">        </span>SBTypeEnumerator<br>

<span style="white-space:pre-wrap">     </span>GetEnumeratorByName (const char *name);<br><br><span style="white-space:pre-wrap">     </span>SBTypeEnumeratorList<br><span style="white-space:pre-wrap">  </span>GetEnumeratorsByValue (int64_t value);<br>

<br><span style="white-space:pre-wrap">   </span>SBTypeEnumeratorList<br><span style="white-space:pre-wrap">  </span>GetEnumeratorsByValue (uint64_t value);<br>};<br><br>Then we would need to add functions to SBType:<br><br>

class SBType<br>{<br><span style="white-space:pre-wrap">    </span>SBTypeEnumeratorList<br><span style="white-space:pre-wrap">  </span>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" target="_blank">russ@eatnumber1.com</a>> wrote:<br><br><blockquote type="cite">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" target="_blank">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" target="_blank">russ@eatnumber1.com</a>> wrote:<br><br><blockquote type="cite">

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" target="_blank">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></blockquote>

<br><br>_______________________________________________<br>lldb-dev mailing list<br><a href="mailto:lldb-dev@cs.uiuc.edu" target="_blank">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>

</blockquote><br></blockquote></div><br></div></div></div></div></div></blockquote></div><br></div>