<div dir="ltr">In:<div><br></div><div><div>svn commit</div><div>Sending include/lldb/API/SBDefines.h</div><div>Sending include/lldb/API/SBStream.h</div><div>Sending include/lldb/API/SBType.h</div><div>
Adding include/lldb/API/SBTypeEnumMember.h</div><div>Sending include/lldb/Core/ClangForward.h</div><div>Sending include/lldb/Symbol/ClangASTType.h</div><div>Sending include/lldb/Symbol/Type.h</div>
<div>Sending include/lldb/lldb-forward.h</div><div>Sending lldb.xcodeproj/project.pbxproj</div><div>Sending scripts/Python/interface/SBType.i</div><div>Adding scripts/Python/interface/SBTypeEnumMember.i</div>
<div>Sending scripts/Python/python-extensions.swig</div><div>Sending scripts/lldb.swig</div><div>Sending source/API/CMakeLists.txt</div><div>Sending source/API/SBType.cpp</div><div>Adding source/API/SBTypeEnumMember.cpp</div>
<div>Sending source/Symbol/ClangASTType.cpp</div><div>Sending source/Symbol/Type.cpp</div><div>Sending test/python_api/type/TestTypeList.py</div><div>Sending test/python_api/type/main.cpp</div>
<div>Transmitting file data ....................</div><div>Committed revision 210046.</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 2, 2014 at 1:17 PM, Todd Fiala <span dir="ltr"><<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'll commit it for you, Russell. He means get somebody to do it :-)</div><div class="gmail_extra"><div>
<div class="h5"><br><br><div class="gmail_quote">On Mon, Jun 2, 2014 at 1:11 PM, Russell Harmon <span dir="ltr"><<a href="mailto:eatnumber1@google.com" target="_blank">eatnumber1@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Perhaps I'm missing something, but I don't believe that I have commit access... unless you weren't referring to me when you say "commit when you can."<div>
<div><br><br><div>On Mon Jun 02 2014 at 1:09:28 PM, Greg Clayton <<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>> wrote:</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The patch looks fine. Please commit when you can.<br>
<br>
> On Jun 2, 2014, at 9:57 AM, Russell Harmon <<a href="mailto:eatnumber1@google.com" target="_blank">eatnumber1@google.com</a>> wrote:<br>
><br>
> ping<br>
><br>
> On Thu May 29 2014 at 10:24:54 PM, Russell Harmon <<a href="mailto:eatnumber1@google.com" target="_blank">eatnumber1@google.com</a>> wrote:<br>
> ---<br>
> include/lldb/API/SBDefines.h | 2 +<br>
> include/lldb/API/SBStream.h | 1 +<br>
> include/lldb/API/SBType.h | 5 +<br>
> include/lldb/API/<u></u>SBTypeEnumMember.h | 98 ++++++++++++++<br>
> include/lldb/Core/<u></u>ClangForward.h | 1 +<br>
> include/lldb/Symbol/<u></u>ClangASTType.h | 3 +<br>
> include/lldb/Symbol/Type.h | 102 ++++++++++++++-<br>
> include/lldb/lldb-forward.h | 3 +<br>
> scripts/Python/interface/<u></u>SBType.i | 14 ++<br>
> scripts/Python/interface/<u></u>SBTypeEnumMember.i | 108 ++++++++++++++++<br>
> scripts/Python/python-<u></u>extensions.swig | 14 ++<br>
> scripts/lldb.swig | 2 +<br>
> source/API/CMakeLists.txt | 1 +<br>
> source/API/SBType.cpp | 24 ++++<br>
> source/API/SBTypeEnumMember.<u></u>cpp | 192 ++++++++++++++++++++++++++++<br>
> source/Symbol/ClangASTType.cpp | 9 ++<br>
> source/Symbol/Type.cpp | 11 ++<br>
> test/python_api/type/<u></u>TestTypeList.py | 5 +<br>
> test/python_api/type/main.cpp | 7 +-<br>
> 19 files changed, 600 insertions(+), 2 deletions(-)<br>
> create mode 100644 include/lldb/API/<u></u>SBTypeEnumMember.h<br>
> create mode 100644 scripts/Python/interface/<u></u>SBTypeEnumMember.i<br>
> create mode 100644 source/API/SBTypeEnumMember.<u></u>cpp<br>
><br>
> diff --git a/include/lldb/API/SBDefines.h b/include/lldb/API/SBDefines.h<br>
> index 6171deb..15d8d1f 100644<br>
> --- a/include/lldb/API/SBDefines.h<br>
> +++ b/include/lldb/API/SBDefines.h<br>
> @@ -72,6 +72,8 @@ class LLDB_API SBTarget;<br>
> class LLDB_API SBThread;<br>
> class LLDB_API SBType;<br>
> class LLDB_API SBTypeCategory;<br>
> +class LLDB_API SBTypeEnumMember;<br>
> +class LLDB_API SBTypeEnumMemberList;<br>
> class LLDB_API SBTypeFilter;<br>
> class LLDB_API SBTypeFormat;<br>
> class LLDB_API SBTypeNameSpecifier;<br>
> diff --git a/include/lldb/API/SBStream.h b/include/lldb/API/SBStream.h<br>
> index 038adf6..f77b7b7 100644<br>
> --- a/include/lldb/API/SBStream.h<br>
> +++ b/include/lldb/API/SBStream.h<br>
> @@ -86,6 +86,7 @@ protected:<br>
> friend class SBTarget;<br>
> friend class SBThread;<br>
> friend class SBType;<br>
> + friend class SBTypeEnumMember;<br>
> friend class SBTypeMember;<br>
> friend class SBValue;<br>
> friend class SBWatchpoint;<br>
> diff --git a/include/lldb/API/SBType.h b/include/lldb/API/SBType.h<br>
> index 2cd9b44..c981639 100644<br>
> --- a/include/lldb/API/SBType.h<br>
> +++ b/include/lldb/API/SBType.h<br>
> @@ -143,6 +143,9 @@ public:<br>
> lldb::SBTypeMember<br>
> GetVirtualBaseClassAtIndex (uint32_t idx);<br>
><br>
> + lldb::SBTypeEnumMemberList<br>
> + GetEnumMembers();<br>
> +<br>
> uint32_t<br>
> GetNumberOfTemplateArguments ();<br>
><br>
> @@ -199,6 +202,8 @@ protected:<br>
> friend class SBFunction;<br>
> friend class SBModule;<br>
> friend class SBTarget;<br>
> + friend class SBTypeEnumMember;<br>
> + friend class SBTypeEnumMemberList;<br>
> friend class SBTypeNameSpecifier;<br>
> friend class SBTypeMember;<br>
> friend class SBTypeList;<br>
> diff --git a/include/lldb/API/<u></u>SBTypeEnumMember.h b/include/lldb/API/<u></u>SBTypeEnumMember.h<br>
> new file mode 100644<br>
> index 0000000..75c9917<br>
> --- /dev/null<br>
> +++ b/include/lldb/API/<u></u>SBTypeEnumMember.h<br>
> @@ -0,0 +1,98 @@<br>
> +<br>
> +//===-- SBTypeEnumMember.h ------------------------------<u></u>--------*- C++ -*-===//<br>
> +//<br>
> +// The LLVM Compiler Infrastructure<br>
> +//<br>
> +// This file is distributed under the University of Illinois Open Source<br>
> +// License. See LICENSE.TXT for details.<br>
> +//<br>
> +//===------------------------<u></u>------------------------------<u></u>----------------===//<br>
> +<br>
> +#ifndef LLDB_SBTypeEnumMember_h_<br>
> +#define LLDB_SBTypeEnumMember_h_<br>
> +<br>
> +#include "lldb/API/SBDefines.h"<br>
> +<br>
> +namespace lldb {<br>
> +<br>
> +class SBTypeEnumMember<br>
> +{<br>
> +public:<br>
> + SBTypeEnumMember ();<br>
> +<br>
> + SBTypeEnumMember (const SBTypeEnumMember& rhs);<br>
> +<br>
> + ~SBTypeEnumMember();<br>
> +<br>
> + SBTypeEnumMember&<br>
> + operator = (const SBTypeEnumMember& rhs);<br>
> +<br>
> + bool<br>
> + IsValid() const;<br>
> +<br>
> + int64_t<br>
> + GetValueAsSigned();<br>
> +<br>
> + uint64_t<br>
> + GetValueAsUnsigned();<br>
> +<br>
> + const char *<br>
> + GetName ();<br>
> +<br>
> + lldb::SBType<br>
> + GetType ();<br>
> +<br>
> + bool<br>
> + GetDescription (lldb::SBStream &description,<br>
> + lldb::DescriptionLevel description_level);<br>
> +<br>
> +protected:<br>
> + friend class SBType;<br>
> + friend class SBTypeEnumMemberList;<br>
> +<br>
> + void<br>
> + reset (lldb_private::<u></u>TypeEnumMemberImpl *);<br>
> +<br>
> + lldb_private::<u></u>TypeEnumMemberImpl &<br>
> + ref ();<br>
> +<br>
> + const lldb_private::<u></u>TypeEnumMemberImpl &<br>
> + ref () const;<br>
> +<br>
> + lldb::TypeEnumMemberImplSP m_opaque_sp;<br>
> +<br>
> + SBTypeEnumMember (const lldb::TypeEnumMemberImplSP &);<br>
> +};<br>
> +<br>
> +class SBTypeEnumMemberList<br>
> +{<br>
> +public:<br>
> + SBTypeEnumMemberList();<br>
> +<br>
> + SBTypeEnumMemberList(const SBTypeEnumMemberList& rhs);<br>
> +<br>
> + ~SBTypeEnumMemberList();<br>
> +<br>
> + SBTypeEnumMemberList&<br>
> + operator = (const SBTypeEnumMemberList& rhs);<br>
> +<br>
> + bool<br>
> + IsValid();<br>
> +<br>
> + void<br>
> + Append (SBTypeEnumMember entry);<br>
> +<br>
> + SBTypeEnumMember<br>
> + GetTypeEnumMemberAtIndex (uint32_t index);<br>
> +<br>
> + uint32_t<br>
> + GetSize();<br>
> +<br>
> +<br>
> +private:<br>
> + std::unique_ptr<lldb_private::<u></u>TypeEnumMemberListImpl> m_opaque_ap;<br>
> +};<br>
> +<br>
> +} // namespace lldb<br>
> +<br>
> +#endif // LLDB_SBTypeEnumMember_h_<br>
> diff --git a/include/lldb/Core/<u></u>ClangForward.h b/include/lldb/Core/<u></u>ClangForward.h<br>
> index 0b3f13a..ef7308d 100644<br>
> --- a/include/lldb/Core/<u></u>ClangForward.h<br>
> +++ b/include/lldb/Core/<u></u>ClangForward.h<br>
> @@ -58,6 +58,7 @@ namespace clang<br>
> class DiagnosticsEngine;<br>
> class DiagnosticOptions;<br>
> class EnumDecl;<br>
> + class EnumConstantDecl;<br>
> class Expr;<br>
> class ExternalASTSource;<br>
> class ExtVectorElementExpr;<br>
> diff --git a/include/lldb/Symbol/<u></u>ClangASTType.h b/include/lldb/Symbol/<u></u>ClangASTType.h<br>
> index 0f2eb96..69c24a8 100644<br>
> --- a/include/lldb/Symbol/<u></u>ClangASTType.h<br>
> +++ b/include/lldb/Symbol/<u></u>ClangASTType.h<br>
> @@ -644,6 +644,9 @@ public:<br>
> AddressType address_type,<br>
> StreamString &new_value);<br>
><br>
> + clang::EnumDecl *<br>
> + GetAsEnumDecl () const;<br>
> +<br>
><br>
> clang::RecordDecl *<br>
> GetAsRecordDecl () const;<br>
> diff --git a/include/lldb/Symbol/Type.h b/include/lldb/Symbol/Type.h<br>
> index da32743..091cc69 100644<br>
> --- a/include/lldb/Symbol/Type.h<br>
> +++ b/include/lldb/Symbol/Type.h<br>
> @@ -17,6 +17,8 @@<br>
> #include "lldb/Symbol/ClangASTType.h"<br>
> #include "lldb/Symbol/Declaration.h"<br>
><br>
> +#include "llvm/ADT/APSInt.h"<br>
> +<br>
> #include <set><br>
><br>
> namespace lldb_private {<br>
> @@ -772,7 +774,105 @@ private:<br>
> TypePair m_type_pair;<br>
> ConstString m_type_name;<br>
> };<br>
> -<br>
> +<br>
> +class TypeEnumMemberImpl<br>
> +{<br>
> +public:<br>
> + TypeEnumMemberImpl () :<br>
> + m_integer_type(),<br>
> + m_name("<invalid>"),<br>
> + m_value(),<br>
> + m_valid(false)<br>
> + {<br>
> + }<br>
> +<br>
> + TypeEnumMemberImpl (const clang::EnumConstantDecl* enum_member_decl,<br>
> + const lldb_private::ClangASTType& integer_type);<br>
> +<br>
> + TypeEnumMemberImpl (const TypeEnumMemberImpl& rhs) :<br>
> + m_integer_type(rhs.m_integer_<u></u>type),<br>
> + m_name(rhs.m_name),<br>
> + m_value(rhs.m_value),<br>
> + m_valid(rhs.m_valid)<br>
> + {<br>
> + }<br>
> +<br>
> + TypeEnumMemberImpl&<br>
> + operator = (const TypeEnumMemberImpl& rhs);<br>
> +<br>
> + bool<br>
> + IsValid ()<br>
> + {<br>
> + return m_valid;<br>
> + }<br>
> +<br>
> + const ConstString &<br>
> + GetName () const<br>
> + {<br>
> + return m_name;<br>
> + }<br>
> +<br>
> + const lldb::TypeImplSP &<br>
> + GetIntegerType () const<br>
> + {<br>
> + return m_integer_type;<br>
> + }<br>
> +<br>
> + uint64_t<br>
> + GetValueAsUnsigned () const<br>
> + {<br>
> + return *m_value.getRawData();<br>
> + }<br>
> +<br>
> + int64_t<br>
> + GetValueAsSigned () const<br>
> + {<br>
> + return (int64_t) *m_value.getRawData();<br>
> + }<br>
> +<br>
> +protected:<br>
> + lldb::TypeImplSP m_integer_type;<br>
> + ConstString m_name;<br>
> + llvm::APSInt m_value;<br>
> + bool m_valid;<br>
> +};<br>
> +<br>
> +class TypeEnumMemberListImpl<br>
> +{<br>
> +public:<br>
> + TypeEnumMemberListImpl() :<br>
> + m_content()<br>
> + {<br>
> + }<br>
> +<br>
> + void<br>
> + Append (const lldb::TypeEnumMemberImplSP& type)<br>
> + {<br>
> + m_content.push_back(type);<br>
> + }<br>
> +<br>
> + void<br>
> + Append (const lldb_private::<u></u>TypeEnumMemberListImpl& type_list);<br>
> +<br>
> + lldb::TypeEnumMemberImplSP<br>
> + GetTypeEnumMemberAtIndex(size_<u></u>t idx)<br>
> + {<br>
> + lldb::TypeEnumMemberImplSP enum_member;<br>
> + if (idx < GetSize())<br>
> + enum_member = m_content[idx];<br>
> + return enum_member;<br>
> + }<br>
> +<br>
> + size_t<br>
> + GetSize()<br>
> + {<br>
> + return m_content.size();<br>
> + }<br>
> +<br>
> +private:<br>
> + std::vector<lldb::<u></u>TypeEnumMemberImplSP> m_content;<br>
> +};<br>
> +<br>
> } // namespace lldb_private<br>
><br>
> #endif // liblldb_Type_h_<br>
> diff --git a/include/lldb/lldb-forward.h b/include/lldb/lldb-forward.h<br>
> index f5539bc..9cd6adb 100644<br>
> --- a/include/lldb/lldb-forward.h<br>
> +++ b/include/lldb/lldb-forward.h<br>
> @@ -244,6 +244,8 @@ class TypeImpl;<br>
> class TypeList;<br>
> class TypeListImpl;<br>
> class TypeMemberImpl;<br>
> +class TypeEnumMemberImpl;<br>
> +class TypeEnumMemberListImpl;<br>
> class TypeNameSpecifierImpl;<br>
> class TypePair;<br>
> class UUID;<br>
> @@ -382,6 +384,7 @@ namespace lldb {<br>
> typedef std::weak_ptr<lldb_private::<u></u>Type> TypeWP;<br>
> typedef std::shared_ptr<lldb_private::<u></u>TypeCategoryImpl> TypeCategoryImplSP;<br>
> typedef std::shared_ptr<lldb_private::<u></u>TypeImpl> TypeImplSP;<br>
> + typedef std::shared_ptr<lldb_private::<u></u>TypeEnumMemberImpl> TypeEnumMemberImplSP;<br>
> typedef std::shared_ptr<lldb_private::<u></u>TypeFilterImpl> TypeFilterImplSP;<br>
> typedef std::shared_ptr<lldb_private::<u></u>TypeFormatImpl> TypeFormatImplSP;<br>
> typedef std::shared_ptr<lldb_private::<u></u>TypeNameSpecifierImpl> TypeNameSpecifierImplSP;<br>
> diff --git a/scripts/Python/interface/<u></u>SBType.i b/scripts/Python/interface/<u></u>SBType.i<br>
> index 936bf2c..4ffec74 100644<br>
> --- a/scripts/Python/interface/<u></u>SBType.i<br>
> +++ b/scripts/Python/interface/<u></u>SBType.i<br>
> @@ -213,6 +213,9 @@ public:<br>
> lldb::SBTypeMember<br>
> GetVirtualBaseClassAtIndex (uint32_t idx);<br>
><br>
> + lldb::SBTypeEnumMemberList<br>
> + GetEnumMembers();<br>
> +<br>
> const char*<br>
> GetName();<br>
><br>
> @@ -342,6 +345,14 @@ public:<br>
> members.append(field)<br>
> return members<br>
><br>
> + def get_enum_members_array(self):<br>
> + '''An accessor function that returns a list() that contains all enum members in an lldb.SBType object.'''<br>
> + enum_members_list = []<br>
> + sb_enum_members = self.GetEnumMembers()<br>
> + for idx in range(sb_enum_members.GetSize(<u></u>)):<br>
> + enum_members_list.append(sb_<u></u>enum_members.<u></u>GetTypeEnumMemberAtIndex(idx))<br>
> + return enum_members_list<br>
> +<br>
> __swig_getmethods__["bases"] = get_bases_array<br>
> if _newclass: bases = property(get_bases_array, None, doc='''A read only property that returns a list() of lldb.SBTypeMember objects that represent all of the direct base classes for this type.''')<br>
><br>
> @@ -354,6 +365,9 @@ public:<br>
> __swig_getmethods__["members"] = get_members_array<br>
> if _newclass: members = property(get_members_array, None, doc='''A read only property that returns a list() of all lldb.SBTypeMember objects that represent all of the base classes, virtual base classes and fields for this type in ascending bit offset order.''')<br>
><br>
> + __swig_getmethods__["enum_<u></u>members"] = get_enum_members_array<br>
> + if _newclass: enum_members = property(get_enum_members_<u></u>array, None, doc='''A read only property that returns a list() of all lldb.SBTypeEnumMember objects that represent the enum members for this type.''')<br>
> +<br>
> %}<br>
><br>
> };<br>
> diff --git a/scripts/Python/interface/<u></u>SBTypeEnumMember.i b/scripts/Python/interface/<u></u>SBTypeEnumMember.i<br>
> new file mode 100644<br>
> index 0000000..02d89f1<br>
> --- /dev/null<br>
> +++ b/scripts/Python/interface/<u></u>SBTypeEnumMember.i<br>
> @@ -0,0 +1,108 @@<br>
> +//===-- SWIG Interface for SBTypeEnumMember ---------------------*- C++ -*-===//<br>
> +//<br>
> +// The LLVM Compiler Infrastructure<br>
> +//<br>
> +// This file is distributed under the University of Illinois Open Source<br>
> +// License. See LICENSE.TXT for details.<br>
> +//<br>
> +//===------------------------<u></u>------------------------------<u></u>----------------===//<br>
> +<br>
> +namespace lldb {<br>
> +<br>
> +%feature(<br>
> + "docstring",<br>
> + "Represents a member of an enum in lldb."<br>
> +) SBTypeEnumMember;<br>
> +<br>
> +class SBTypeEnumMember<br>
> +{<br>
> +public:<br>
> + SBTypeEnumMember ();<br>
> +<br>
> + SBTypeEnumMember (const SBTypeEnumMember& rhs);<br>
> +<br>
> + ~SBTypeEnumMember();<br>
> +<br>
> + bool<br>
> + IsValid() const;<br>
> +<br>
> + int64_t<br>
> + GetValueAsSigned();<br>
> +<br>
> + uint64_t<br>
> + GetValueAsUnsigned();<br>
> +<br>
> + const char *<br>
> + GetName ();<br>
> +<br>
> + lldb::SBType<br>
> + GetType ();<br>
> +<br>
> + bool<br>
> + GetDescription (lldb::SBStream &description,<br>
> + lldb::DescriptionLevel description_level);<br>
> +<br>
> + %pythoncode %{<br>
> + __swig_getmethods__["name"] = GetName<br>
> + if _newclass: name = property(GetName, None, doc='''A read only property that returns the name for this enum member as a string.''')<br>
> +<br>
> + __swig_getmethods__["type"] = GetType<br>
> + if _newclass: type = property(GetType, None, doc='''A read only property that returns an lldb object that represents the type (lldb.SBType) for this enum member.''')<br>
> +<br>
> + __swig_getmethods__["signed"] = GetValueAsSigned<br>
> + if _newclass: signed = property(GetValueAsSigned, None, doc='''A read only property that returns the value of this enum member as a signed integer.''')<br>
> +<br>
> + __swig_getmethods__["unsigned"<u></u>] = GetValueAsUnsigned<br>
> + if _newclass: unsigned = property(GetValueAsUnsigned, None, doc='''A read only property that returns the value of this enum member as a unsigned integer.''')<br>
> + %}<br>
> +<br>
> +protected:<br>
> + friend class SBType;<br>
> + friend class SBTypeEnumMemberList;<br>
> +<br>
> + void<br>
> + reset (lldb_private::<u></u>TypeEnumMemberImpl *);<br>
> +<br>
> + lldb_private::<u></u>TypeEnumMemberImpl &<br>
> + ref ();<br>
> +<br>
> + const lldb_private::<u></u>TypeEnumMemberImpl &<br>
> + ref () const;<br>
> +<br>
> + lldb::TypeEnumMemberImplSP m_opaque_sp;<br>
> +<br>
> + SBTypeEnumMember (const lldb::TypeEnumMemberImplSP &);<br>
> +};<br>
> +<br>
> +%feature(<br>
> + "docstring",<br>
> + "Represents a list of SBTypeEnumMembers."<br>
> +) SBTypeEnumMemberList;<br>
> +<br>
> +class SBTypeEnumMemberList<br>
> +{<br>
> +public:<br>
> + SBTypeEnumMemberList();<br>
> +<br>
> + SBTypeEnumMemberList(const SBTypeEnumMemberList& rhs);<br>
> +<br>
> + ~SBTypeEnumMemberList();<br>
> +<br>
> + bool<br>
> + IsValid();<br>
> +<br>
> + void<br>
> + Append (SBTypeEnumMember entry);<br>
> +<br>
> + SBTypeEnumMember<br>
> + GetTypeEnumMemberAtIndex (uint32_t index);<br>
> +<br>
> + uint32_t<br>
> + GetSize();<br>
> +<br>
> +<br>
> +private:<br>
> + std::unique_ptr<lldb_private::<u></u>TypeEnumMemberListImpl> m_opaque_ap;<br>
> +};<br>
> +<br>
> +} // namespace lldb<br>
> diff --git a/scripts/Python/python-<u></u>extensions.swig b/scripts/Python/python-<u></u>extensions.swig<br>
> index 3dbcb88..9e9feb8 100644<br>
> --- a/scripts/Python/python-<u></u>extensions.swig<br>
> +++ b/scripts/Python/python-<u></u>extensions.swig<br>
> @@ -608,6 +608,20 @@<br>
> return PyString_FromString("");<br>
> }<br>
> }<br>
> +%extend lldb::SBTypeEnumMember {<br>
> + PyObject *lldb::SBTypeEnumMember::__<u></u>str__ (){<br>
> + lldb::SBStream description;<br>
> + $self->GetDescription (description, lldb::eDescriptionLevelBrief);<br>
> + const char *desc = description.GetData();<br>
> + size_t desc_len = description.GetSize();<br>
> + if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))<br>
> + --desc_len;<br>
> + if (desc_len > 0)<br>
> + return PyString_FromStringAndSize (desc, desc_len);<br>
> + else<br>
> + return PyString_FromString("");<br>
> + }<br>
> +}<br>
> %extend lldb::SBTypeNameSpecifier {<br>
> PyObject *lldb::SBTypeNameSpecifier::__<u></u>str__ (){<br>
> lldb::SBStream description;<br>
> diff --git a/scripts/lldb.swig b/scripts/lldb.swig<br>
> index 8633f15..1a230d1 100644<br>
> --- a/scripts/lldb.swig<br>
> +++ b/scripts/lldb.swig<br>
> @@ -93,6 +93,7 @@ import os<br>
> #include "lldb/API/SBThread.h"<br>
> #include "lldb/API/SBType.h"<br>
> #include "lldb/API/SBTypeCategory.h"<br>
> +#include "lldb/API/SBTypeEnumMember.h"<br>
> #include "lldb/API/SBTypeFilter.h"<br>
> #include "lldb/API/SBTypeFormat.h"<br>
> #include "lldb/API/SBTypeNameSpecifier.<u></u>h"<br>
> @@ -159,6 +160,7 @@ import os<br>
> %include "./Python/interface/SBThread.<u></u>i"<br>
> %include "./Python/interface/SBType.i"<br>
> %include "./Python/interface/<u></u>SBTypeCategory.i"<br>
> +%include "./Python/interface/<u></u>SBTypeEnumMember.i"<br>
> %include "./Python/interface/<u></u>SBTypeFilter.i"<br>
> %include "./Python/interface/<u></u>SBTypeFormat.i"<br>
> %include "./Python/interface/<u></u>SBTypeNameSpecifier.i"<br>
> diff --git a/source/API/CMakeLists.txt b/source/API/CMakeLists.txt<br>
> index a626f61..63adb68 100644<br>
> --- a/source/API/CMakeLists.txt<br>
> +++ b/source/API/CMakeLists.txt<br>
> @@ -42,6 +42,7 @@ add_lldb_library(lldbAPI<br>
> SBThread.cpp<br>
> SBType.cpp<br>
> SBTypeCategory.cpp<br>
> + SBTypeEnumMember.cpp<br>
> SBTypeFilter.cpp<br>
> SBTypeFormat.cpp<br>
> SBTypeNameSpecifier.cpp<br>
> diff --git a/source/API/SBType.cpp b/source/API/SBType.cpp<br>
> index 5ca7ddf..270efd3 100644<br>
> --- a/source/API/SBType.cpp<br>
> +++ b/source/API/SBType.cpp<br>
> @@ -9,6 +9,7 @@<br>
><br>
> #include "lldb/API/SBDefines.h"<br>
> #include "lldb/API/SBType.h"<br>
> +#include "lldb/API/SBTypeEnumMember.h"<br>
> #include "lldb/API/SBStream.h"<br>
> #include "lldb/Core/ConstString.h"<br>
> #include "lldb/Core/Log.h"<br>
> @@ -17,6 +18,8 @@<br>
> #include "lldb/Symbol/ClangASTType.h"<br>
> #include "lldb/Symbol/Type.h"<br>
><br>
> +#include "clang/AST/Decl.h"<br>
> +<br>
> using namespace lldb;<br>
> using namespace lldb_private;<br>
> using namespace clang;<br>
> @@ -364,6 +367,27 @@ SBType::<u></u>GetVirtualBaseClassAtIndex (uint32_t idx)<br>
> return sb_type_member;<br>
> }<br>
><br>
> +SBTypeEnumMemberList<br>
> +SBType::GetEnumMembers ()<br>
> +{<br>
> + SBTypeEnumMemberList sb_enum_member_list;<br>
> + if (IsValid())<br>
> + {<br>
> + const clang::EnumDecl *enum_decl = m_opaque_sp->GetClangASTType(<u></u>true).GetFullyUnqualifiedType(<u></u>).GetAsEnumDecl();<br>
> + if (enum_decl)<br>
> + {<br>
> + clang::EnumDecl::enumerator_<u></u>iterator enum_pos, enum_end_pos;<br>
> + for (enum_pos = enum_decl->enumerator_begin(), enum_end_pos = enum_decl->enumerator_end(); enum_pos != enum_end_pos; ++enum_pos)<br>
> + {<br>
> + SBTypeEnumMember enum_member;<br>
> + enum_member.reset(new TypeEnumMemberImpl(*enum_pos, ClangASTType(m_opaque_sp-><u></u>GetClangASTContext(true), enum_decl->getIntegerType())))<u></u>;<br>
> + sb_enum_member_list.Append(<u></u>enum_member);<br>
> + }<br>
> + }<br>
> + }<br>
> + return sb_enum_member_list;<br>
> +}<br>
> +<br>
> SBTypeMember<br>
> SBType::GetFieldAtIndex (uint32_t idx)<br>
> {<br>
> diff --git a/source/API/SBTypeEnumMember.<u></u>cpp b/source/API/SBTypeEnumMember.<u></u>cpp<br>
> new file mode 100644<br>
> index 0000000..47c57dd<br>
> --- /dev/null<br>
> +++ b/source/API/SBTypeEnumMember.<u></u>cpp<br>
> @@ -0,0 +1,192 @@<br>
> +//===-- SBTypeEnumMember.cpp ------------------------------<u></u>---- -*- C++ -*-===//<br>
> +//<br>
> +// The LLVM Compiler Infrastructure<br>
> +//<br>
> +// This file is distributed under the University of Illinois Open Source<br>
> +// License. See LICENSE.TXT for details.<br>
> +//<br>
> +//===------------------------<u></u>------------------------------<u></u>----------------===//<br>
> +<br>
> +#include "lldb/API/SBDefines.h"<br>
> +#include "lldb/API/SBType.h"<br>
> +#include "lldb/API/SBTypeEnumMember.h"<br>
> +#include "lldb/API/SBStream.h"<br>
> +#include "lldb/Core/Stream.h"<br>
> +#include "lldb/Symbol/ClangASTType.h"<br>
> +#include "lldb/Symbol/Type.h"<br>
> +<br>
> +using namespace lldb;<br>
> +using namespace lldb_private;<br>
> +using namespace clang;<br>
> +<br>
> +SBTypeEnumMember::<u></u>SBTypeEnumMember() :<br>
> + m_opaque_sp()<br>
> +{<br>
> +}<br>
> +<br>
> +SBTypeEnumMember::~<u></u>SBTypeEnumMember()<br>
> +{<br>
> +}<br>
> +SBTypeEnumMember::<u></u>SBTypeEnumMember (const lldb::TypeEnumMemberImplSP &enum_member_sp) :<br>
> + m_opaque_sp(enum_member_sp)<br>
> +{<br>
> +}<br>
> +<br>
> +SBTypeEnumMember::<u></u>SBTypeEnumMember (const SBTypeEnumMember& rhs) :<br>
> + m_opaque_sp()<br>
> +{<br>
> + if (this != &rhs)<br>
> + {<br>
> + if (rhs.IsValid())<br>
> + m_opaque_sp.reset(new TypeEnumMemberImpl(rhs.ref()))<u></u>;<br>
> + }<br>
> +}<br>
> +<br>
> +SBTypeEnumMember&<br>
> +SBTypeEnumMember::operator = (const SBTypeEnumMember& rhs)<br>
> +{<br>
> + if (this != &rhs)<br>
> + {<br>
> + if (rhs.IsValid())<br>
> + m_opaque_sp.reset(new TypeEnumMemberImpl(rhs.ref()))<u></u>;<br>
> + }<br>
> + return *this;<br>
> +}<br>
> +<br>
> +bool<br>
> +SBTypeEnumMember::IsValid() const<br>
> +{<br>
> + return m_opaque_sp.get();<br>
> +}<br>
> +<br>
> +const char *<br>
> +SBTypeEnumMember::GetName ()<br>
> +{<br>
> + if (m_opaque_sp.get())<br>
> + return m_opaque_sp->GetName().<u></u>GetCString();<br>
> + return NULL;<br>
> +}<br>
> +<br>
> +int64_t<br>
> +SBTypeEnumMember::<u></u>GetValueAsSigned()<br>
> +{<br>
> + if (m_opaque_sp.get())<br>
> + return m_opaque_sp->GetValueAsSigned(<u></u>);<br>
> + return 0;<br>
> +}<br>
> +<br>
> +uint64_t<br>
> +SBTypeEnumMember::<u></u>GetValueAsUnsigned()<br>
> +{<br>
> + if (m_opaque_sp.get())<br>
> + return m_opaque_sp-><u></u>GetValueAsUnsigned();<br>
> + return 0;<br>
> +}<br>
> +<br>
> +SBType<br>
> +SBTypeEnumMember::GetType ()<br>
> +{<br>
> + SBType sb_type;<br>
> + if (m_opaque_sp.get())<br>
> + {<br>
> + sb_type.SetSP(m_opaque_sp-><u></u>GetIntegerType());<br>
> + }<br>
> + return sb_type;<br>
> +<br>
> +}<br>
> +<br>
> +void<br>
> +SBTypeEnumMember::reset(<u></u>TypeEnumMemberImpl *type_member_impl)<br>
> +{<br>
> + m_opaque_sp.reset(type_member_<u></u>impl);<br>
> +}<br>
> +<br>
> +TypeEnumMemberImpl &<br>
> +SBTypeEnumMember::ref ()<br>
> +{<br>
> + if (m_opaque_sp.get() == NULL)<br>
> + m_opaque_sp.reset (new TypeEnumMemberImpl());<br>
> + return *m_opaque_sp.get();<br>
> +}<br>
> +<br>
> +const TypeEnumMemberImpl &<br>
> +SBTypeEnumMember::ref () const<br>
> +{<br>
> + return *m_opaque_sp.get();<br>
> +}<br>
> +<br>
> +<br>
> +SBTypeEnumMemberList::<u></u>SBTypeEnumMemberList() :<br>
> + m_opaque_ap(new TypeEnumMemberListImpl())<br>
> +{<br>
> +}<br>
> +<br>
> +SBTypeEnumMemberList::<u></u>SBTypeEnumMemberList(const SBTypeEnumMemberList& rhs) :<br>
> + m_opaque_ap(new TypeEnumMemberListImpl())<br>
> +{<br>
> + for (uint32_t i = 0, rhs_size = const_cast<<u></u>SBTypeEnumMemberList&>(rhs).<u></u>GetSize(); i < rhs_size; i++)<br>
> + Append(const_cast<<u></u>SBTypeEnumMemberList&>(rhs).<u></u>GetTypeEnumMemberAtIndex(i));<br>
> +}<br>
> +<br>
> +bool<br>
> +SBTypeEnumMemberList::IsValid ()<br>
> +{<br>
> + return (m_opaque_ap.get() != NULL);<br>
> +}<br>
> +<br>
> +SBTypeEnumMemberList&<br>
> +SBTypeEnumMemberList::<u></u>operator = (const SBTypeEnumMemberList& rhs)<br>
> +{<br>
> + if (this != &rhs)<br>
> + {<br>
> + m_opaque_ap.reset (new TypeEnumMemberListImpl());<br>
> + for (uint32_t i = 0, rhs_size = const_cast<<u></u>SBTypeEnumMemberList&>(rhs).<u></u>GetSize(); i < rhs_size; i++)<br>
> + Append(const_cast<<u></u>SBTypeEnumMemberList&>(rhs).<u></u>GetTypeEnumMemberAtIndex(i));<br>
> + }<br>
> + return *this;<br>
> +}<br>
> +<br>
> +void<br>
> +SBTypeEnumMemberList::Append (SBTypeEnumMember enum_member)<br>
> +{<br>
> + if (enum_member.IsValid())<br>
> + m_opaque_ap->Append (enum_member.m_opaque_sp);<br>
> +}<br>
> +<br>
> +SBTypeEnumMember<br>
> +SBTypeEnumMemberList::<u></u>GetTypeEnumMemberAtIndex(<u></u>uint32_t index)<br>
> +{<br>
> + if (m_opaque_ap.get())<br>
> + return SBTypeEnumMember(m_opaque_ap-><u></u>GetTypeEnumMemberAtIndex(<u></u>index));<br>
> + return SBTypeEnumMember();<br>
> +}<br>
> +<br>
> +uint32_t<br>
> +SBTypeEnumMemberList::<u></u>GetSize()<br>
> +{<br>
> + return m_opaque_ap->GetSize();<br>
> +}<br>
> +<br>
> +SBTypeEnumMemberList::~<u></u>SBTypeEnumMemberList()<br>
> +{<br>
> +}<br>
> +<br>
> +bool<br>
> +SBTypeEnumMember::<u></u>GetDescription (lldb::SBStream &description,<br>
> + lldb::DescriptionLevel description_level)<br>
> +{<br>
> + Stream &strm = description.ref();<br>
> +<br>
> + if (m_opaque_sp.get())<br>
> + {<br>
> + if( m_opaque_sp->GetIntegerType()-<u></u>>GetDescription(strm, description_level) )<br>
> + {<br>
> + strm.Printf(" %s", m_opaque_sp->GetName().<u></u>GetCString());<br>
> + }<br>
> + }<br>
> + else<br>
> + {<br>
> + strm.PutCString ("No value");<br>
> + }<br>
> + return true;<br>
> +}<br>
> diff --git a/source/Symbol/ClangASTType.<u></u>cpp b/source/Symbol/ClangASTType.<u></u>cpp<br>
> index 20ac65f..a837df0 100644<br>
> --- a/source/Symbol/ClangASTType.<u></u>cpp<br>
> +++ b/source/Symbol/ClangASTType.<u></u>cpp<br>
> @@ -4447,6 +4447,15 @@ IsOperator (const char *name, clang::OverloadedOperatorKind &op_kind)<br>
> return true;<br>
> }<br>
><br>
> +clang::EnumDecl *<br>
> +ClangASTType::GetAsEnumDecl () const<br>
> +{<br>
> + const clang::EnumType *enum_type = llvm::dyn_cast<clang::<u></u>EnumType>(<u></u>GetCanonicalQualType());<br>
> + if (enum_type)<br>
> + return enum_type->getDecl();<br>
> + return NULL;<br>
> +}<br>
> +<br>
> clang::RecordDecl *<br>
> ClangASTType::GetAsRecordDecl () const<br>
> {<br>
> diff --git a/source/Symbol/Type.cpp b/source/Symbol/Type.cpp<br>
> index cabdbba..aeca139 100644<br>
> --- a/source/Symbol/Type.cpp<br>
> +++ b/source/Symbol/Type.cpp<br>
> @@ -30,6 +30,8 @@<br>
><br>
> #include "llvm/ADT/StringRef.h"<br>
><br>
> +#include "clang/AST/Decl.h"<br>
> +<br>
> using namespace lldb;<br>
> using namespace lldb_private;<br>
><br>
> @@ -1158,3 +1160,12 @@ TypeImpl::GetDescription (lldb_private::Stream &strm,<br>
> m_static_type.GetClangASTType(<u></u>).DumpTypeDescription(&strm);<br>
> return true;<br>
> }<br>
> +<br>
> +TypeEnumMemberImpl::<u></u>TypeEnumMemberImpl (const clang::EnumConstantDecl* enum_member_decl,<br>
> + const lldb_private::ClangASTType& integer_type) :<br>
> + m_value(enum_member_decl-><u></u>getInitVal()),<br>
> + m_integer_type(new TypeImpl(integer_type))<br>
> +{<br>
> + m_name = ConstString(enum_member_decl-><u></u>getNameAsString().c_str());<br>
> + m_valid = true;<br>
> +}<br>
> diff --git a/test/python_api/type/<u></u>TestTypeList.py b/test/python_api/type/<u></u>TestTypeList.py<br>
> index 39f4a29..71d1f45 100644<br>
> --- a/test/python_api/type/<u></u>TestTypeList.py<br>
> +++ b/test/python_api/type/<u></u>TestTypeList.py<br>
> @@ -70,6 +70,11 @@ class TypeAndTypeListTestCase(<u></u>TestBase):<br>
> for type in type_list:<br>
> self.assertTrue(type)<br>
> self.DebugSBType(type)<br>
> + for field in type.fields:<br>
> + if <a href="http://field.name" target="_blank">field.name</a> == "type":<br>
> + for enum_member in field.type.enum_members:<br>
> + self.assertTrue(enum_member)<br>
> + self.DebugSBType(enum_member.<u></u>type)<br>
><br>
> # Pass an empty string. LLDB should not crash. :-)<br>
> fuzz_types = target.FindTypes(None)<br>
> diff --git a/test/python_api/type/main.<u></u>cpp b/test/python_api/type/main.<u></u>cpp<br>
> index db0e249..67b57ac 100644<br>
> --- a/test/python_api/type/main.<u></u>cpp<br>
> +++ b/test/python_api/type/main.<u></u>cpp<br>
> @@ -12,9 +12,14 @@ class Task {<br>
> public:<br>
> int id;<br>
> Task *next;<br>
> + enum {<br>
> + TASK_TYPE_1,<br>
> + TASK_TYPE_2<br>
> + } type;<br>
> Task(int i, Task *n):<br>
> id(i),<br>
> - next(n)<br>
> + next(n),<br>
> + type(TASK_TYPE_1)<br>
> {}<br>
> };<br>
><br>
> --<br>
> 1.9.1.423.g4596e3a<br>
><br>
> ______________________________<u></u>_________________<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/<u></u>mailman/listinfo/lldb-dev</a><br>
<br>
</blockquote>
</div></div><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>
<br></blockquote></div><br><br clear="all"><div><br></div></div></div><div class="">-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
<td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td>
<td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</div>