<div dir="ltr">I'll commit it for you, Russell.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 2, 2014 at 1:09 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">The patch looks fine. Please commit when you can.<br>
<div class="HOEnZb"><div class="h5"><br>
> On Jun 2, 2014, at 9:57 AM, Russell Harmon <<a href="mailto:eatnumber1@google.com">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">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/SBTypeEnumMember.h         |  98 ++++++++++++++<br>
>  include/lldb/Core/ClangForward.h            |   1 +<br>
>  include/lldb/Symbol/ClangASTType.h          |   3 +<br>
>  include/lldb/Symbol/Type.h                  | 102 ++++++++++++++-<br>
>  include/lldb/lldb-forward.h                 |   3 +<br>
>  scripts/Python/interface/SBType.i           |  14 ++<br>
>  scripts/Python/interface/SBTypeEnumMember.i | 108 ++++++++++++++++<br>
>  scripts/Python/python-extensions.swig       |  14 ++<br>
>  scripts/lldb.swig                           |   2 +<br>
>  source/API/CMakeLists.txt                   |   1 +<br>
>  source/API/SBType.cpp                       |  24 ++++<br>
>  source/API/SBTypeEnumMember.cpp             | 192 ++++++++++++++++++++++++++++<br>
>  source/Symbol/ClangASTType.cpp              |   9 ++<br>
>  source/Symbol/Type.cpp                      |  11 ++<br>
>  test/python_api/type/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/SBTypeEnumMember.h<br>
>  create mode 100644 scripts/Python/interface/SBTypeEnumMember.i<br>
>  create mode 100644 source/API/SBTypeEnumMember.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/SBTypeEnumMember.h b/include/lldb/API/SBTypeEnumMember.h<br>
> new file mode 100644<br>
> index 0000000..75c9917<br>
> --- /dev/null<br>
> +++ b/include/lldb/API/SBTypeEnumMember.h<br>
> @@ -0,0 +1,98 @@<br>
> +<br>
> +//===-- SBTypeEnumMember.h --------------------------------------*- 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>
> +//===----------------------------------------------------------------------===//<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::TypeEnumMemberImpl *);<br>
> +<br>
> +    lldb_private::TypeEnumMemberImpl &<br>
> +    ref ();<br>
> +<br>
> +    const lldb_private::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::TypeEnumMemberListImpl> m_opaque_ap;<br>
> +};<br>
> +<br>
> +} // namespace lldb<br>
> +<br>
> +#endif // LLDB_SBTypeEnumMember_h_<br>
> diff --git a/include/lldb/Core/ClangForward.h b/include/lldb/Core/ClangForward.h<br>
> index 0b3f13a..ef7308d 100644<br>
> --- a/include/lldb/Core/ClangForward.h<br>
> +++ b/include/lldb/Core/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/ClangASTType.h b/include/lldb/Symbol/ClangASTType.h<br>
> index 0f2eb96..69c24a8 100644<br>
> --- a/include/lldb/Symbol/ClangASTType.h<br>
> +++ b/include/lldb/Symbol/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_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::TypeEnumMemberListImpl& type_list);<br>
> +<br>
> +    lldb::TypeEnumMemberImplSP<br>
> +    GetTypeEnumMemberAtIndex(size_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::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::Type> TypeWP;<br>
>      typedef std::shared_ptr<lldb_private::TypeCategoryImpl> TypeCategoryImplSP;<br>
>      typedef std::shared_ptr<lldb_private::TypeImpl> TypeImplSP;<br>
> +    typedef std::shared_ptr<lldb_private::TypeEnumMemberImpl> TypeEnumMemberImplSP;<br>
>      typedef std::shared_ptr<lldb_private::TypeFilterImpl> TypeFilterImplSP;<br>
>      typedef std::shared_ptr<lldb_private::TypeFormatImpl> TypeFormatImplSP;<br>
>      typedef std::shared_ptr<lldb_private::TypeNameSpecifierImpl> TypeNameSpecifierImplSP;<br>
> diff --git a/scripts/Python/interface/SBType.i b/scripts/Python/interface/SBType.i<br>
> index 936bf2c..4ffec74 100644<br>
> --- a/scripts/Python/interface/SBType.i<br>
> +++ b/scripts/Python/interface/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()):<br>
> +                enum_members_list.append(sb_enum_members.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_members"] = get_enum_members_array<br>
> +        if _newclass: enum_members = property(get_enum_members_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/SBTypeEnumMember.i b/scripts/Python/interface/SBTypeEnumMember.i<br>
> new file mode 100644<br>
> index 0000000..02d89f1<br>
> --- /dev/null<br>
> +++ b/scripts/Python/interface/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>
> +//===----------------------------------------------------------------------===//<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"] = 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::TypeEnumMemberImpl *);<br>
> +<br>
> +    lldb_private::TypeEnumMemberImpl &<br>
> +    ref ();<br>
> +<br>
> +    const lldb_private::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::TypeEnumMemberListImpl> m_opaque_ap;<br>
> +};<br>
> +<br>
> +} // namespace lldb<br>
> diff --git a/scripts/Python/python-extensions.swig b/scripts/Python/python-extensions.swig<br>
> index 3dbcb88..9e9feb8 100644<br>
> --- a/scripts/Python/python-extensions.swig<br>
> +++ b/scripts/Python/python-extensions.swig<br>
> @@ -608,6 +608,20 @@<br>
>                      return PyString_FromString("");<br>
>          }<br>
>  }<br>
> +%extend lldb::SBTypeEnumMember {<br>
> +        PyObject *lldb::SBTypeEnumMember::__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::__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.h"<br>
> @@ -159,6 +160,7 @@ import os<br>
>  %include "./Python/interface/SBThread.i"<br>
>  %include "./Python/interface/SBType.i"<br>
>  %include "./Python/interface/SBTypeCategory.i"<br>
> +%include "./Python/interface/SBTypeEnumMember.i"<br>
>  %include "./Python/interface/SBTypeFilter.i"<br>
>  %include "./Python/interface/SBTypeFormat.i"<br>
>  %include "./Python/interface/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::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(true).GetFullyUnqualifiedType().GetAsEnumDecl();<br>
> +        if (enum_decl)<br>
> +        {<br>
> +            clang::EnumDecl::enumerator_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->GetClangASTContext(true), enum_decl->getIntegerType())));<br>
> +                sb_enum_member_list.Append(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.cpp b/source/API/SBTypeEnumMember.cpp<br>
> new file mode 100644<br>
> index 0000000..47c57dd<br>
> --- /dev/null<br>
> +++ b/source/API/SBTypeEnumMember.cpp<br>
> @@ -0,0 +1,192 @@<br>
> +//===-- SBTypeEnumMember.cpp ---------------------------------- -*- 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>
> +//===----------------------------------------------------------------------===//<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::SBTypeEnumMember() :<br>
> +    m_opaque_sp()<br>
> +{<br>
> +}<br>
> +<br>
> +SBTypeEnumMember::~SBTypeEnumMember()<br>
> +{<br>
> +}<br>
> +SBTypeEnumMember::SBTypeEnumMember (const lldb::TypeEnumMemberImplSP &enum_member_sp) :<br>
> +    m_opaque_sp(enum_member_sp)<br>
> +{<br>
> +}<br>
> +<br>
> +SBTypeEnumMember::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()));<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()));<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().GetCString();<br>
> +    return NULL;<br>
> +}<br>
> +<br>
> +int64_t<br>
> +SBTypeEnumMember::GetValueAsSigned()<br>
> +{<br>
> +    if (m_opaque_sp.get())<br>
> +        return m_opaque_sp->GetValueAsSigned();<br>
> +    return 0;<br>
> +}<br>
> +<br>
> +uint64_t<br>
> +SBTypeEnumMember::GetValueAsUnsigned()<br>
> +{<br>
> +    if (m_opaque_sp.get())<br>
> +        return m_opaque_sp->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->GetIntegerType());<br>
> +    }<br>
> +    return sb_type;<br>
> +<br>
> +}<br>
> +<br>
> +void<br>
> +SBTypeEnumMember::reset(TypeEnumMemberImpl *type_member_impl)<br>
> +{<br>
> +    m_opaque_sp.reset(type_member_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::SBTypeEnumMemberList() :<br>
> +    m_opaque_ap(new TypeEnumMemberListImpl())<br>
> +{<br>
> +}<br>
> +<br>
> +SBTypeEnumMemberList::SBTypeEnumMemberList(const SBTypeEnumMemberList& rhs) :<br>
> +    m_opaque_ap(new TypeEnumMemberListImpl())<br>
> +{<br>
> +    for (uint32_t i = 0, rhs_size = const_cast<SBTypeEnumMemberList&>(rhs).GetSize(); i < rhs_size; i++)<br>
> +        Append(const_cast<SBTypeEnumMemberList&>(rhs).GetTypeEnumMemberAtIndex(i));<br>
> +}<br>
> +<br>
> +bool<br>
> +SBTypeEnumMemberList::IsValid ()<br>
> +{<br>
> +    return (m_opaque_ap.get() != NULL);<br>
> +}<br>
> +<br>
> +SBTypeEnumMemberList&<br>
> +SBTypeEnumMemberList::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<SBTypeEnumMemberList&>(rhs).GetSize(); i < rhs_size; i++)<br>
> +            Append(const_cast<SBTypeEnumMemberList&>(rhs).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::GetTypeEnumMemberAtIndex(uint32_t index)<br>
> +{<br>
> +    if (m_opaque_ap.get())<br>
> +        return SBTypeEnumMember(m_opaque_ap->GetTypeEnumMemberAtIndex(index));<br>
> +    return SBTypeEnumMember();<br>
> +}<br>
> +<br>
> +uint32_t<br>
> +SBTypeEnumMemberList::GetSize()<br>
> +{<br>
> +    return m_opaque_ap->GetSize();<br>
> +}<br>
> +<br>
> +SBTypeEnumMemberList::~SBTypeEnumMemberList()<br>
> +{<br>
> +}<br>
> +<br>
> +bool<br>
> +SBTypeEnumMember::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()->GetDescription(strm, description_level) )<br>
> +        {<br>
> +            strm.Printf(" %s", m_opaque_sp->GetName().GetCString());<br>
> +        }<br>
> +    }<br>
> +    else<br>
> +    {<br>
> +        strm.PutCString ("No value");<br>
> +    }<br>
> +    return true;<br>
> +}<br>
> diff --git a/source/Symbol/ClangASTType.cpp b/source/Symbol/ClangASTType.cpp<br>
> index 20ac65f..a837df0 100644<br>
> --- a/source/Symbol/ClangASTType.cpp<br>
> +++ b/source/Symbol/ClangASTType.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::EnumType>(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().DumpTypeDescription(&strm);<br>
>      return true;<br>
>  }<br>
> +<br>
> +TypeEnumMemberImpl::TypeEnumMemberImpl (const clang::EnumConstantDecl* enum_member_decl,<br>
> +                                        const lldb_private::ClangASTType& integer_type) :<br>
> +    m_value(enum_member_decl->getInitVal()),<br>
> +    m_integer_type(new TypeImpl(integer_type))<br>
> +{<br>
> +    m_name = ConstString(enum_member_decl->getNameAsString().c_str());<br>
> +    m_valid = true;<br>
> +}<br>
> diff --git a/test/python_api/type/TestTypeList.py b/test/python_api/type/TestTypeList.py<br>
> index 39f4a29..71d1f45 100644<br>
> --- a/test/python_api/type/TestTypeList.py<br>
> +++ b/test/python_api/type/TestTypeList.py<br>
> @@ -70,6 +70,11 @@ class TypeAndTypeListTestCase(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.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.cpp b/test/python_api/type/main.cpp<br>
> index db0e249..67b57ac 100644<br>
> --- a/test/python_api/type/main.cpp<br>
> +++ b/test/python_api/type/main.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>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<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>
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>
</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>