<div dir="ltr">I had figured that a client could figure that out by looking at the enum member's type. I'll add it though</div><div class="gmail_extra"><br clear="all"><div>--<br>Russell Harmon</div>
<br><br><div class="gmail_quote">On Thu, Nov 7, 2013 at 12:53 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">

Looks good. The only thing I can think of is we might want to expose the following function:<br>
<br>
bool<br>
SBTypeEnumMember::IsSigned();<br>
<br>
That way clients know if each member is signed or not. I know that each enum member in clang code knows if it is signed or not.<br>
<span class="HOEnZb"><font color="#888888"><br>
Greg<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Nov 7, 2013, at 11:16 AM, Russell Harmon <<a href="mailto:russ@eatnumber1.com">russ@eatnumber1.com</a>> wrote:<br>
<br>
> bump<br>
><br>
> --<br>
> Russell Harmon<br>
><br>
><br>
> On Sat, Oct 26, 2013 at 7:32 AM, Russell Harmon <<a href="mailto:russ@eatnumber1.com">russ@eatnumber1.com</a>> wrote:<br>
> Here ya' go. Let me know if it needs some changes.<br>
><br>
> --<br>
> Russell Harmon<br>
><br>
> From 72332118f0c23360633f4ab4df8590e0451dd39b Mon Sep 17 00:00:00 2001<br>
> From: Russell Harmon <<a href="mailto:russ@eatnumber1.com">russ@eatnumber1.com</a>><br>
> Date: Sat, 26 Oct 2013 07:26:17 -0700<br>
> Subject: [PATCH] Add support for inspecting enum members.<br>
><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         |   97 ++++++++++++++<br>
>  include/lldb/Core/ClangForward.h            |    1 +<br>
>  include/lldb/Symbol/ClangASTType.h          |    3 +<br>
>  include/lldb/Symbol/Type.h                  |   99 +++++++++++++-<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, 596 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 2cdf921..971e449 100644<br>
> --- a/include/lldb/API/SBDefines.h<br>
> +++ b/include/lldb/API/SBDefines.h<br>
> @@ -67,6 +67,8 @@ class SBTarget;<br>
>  class SBThread;<br>
>  class SBType;<br>
>  class SBTypeCategory;<br>
> +class SBTypeEnumMember;<br>
> +class SBTypeEnumMemberList;<br>
>  class SBTypeFilter;<br>
>  class SBTypeFormat;<br>
>  class 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 3729b2f..1f9ec63 100644<br>
> --- a/include/lldb/API/SBType.h<br>
> +++ b/include/lldb/API/SBType.h<br>
> @@ -140,6 +140,9 @@ public:<br>
>      lldb::SBTypeMember<br>
>      GetVirtualBaseClassAtIndex (uint32_t idx);<br>
><br>
> +    lldb::SBTypeEnumMemberList<br>
> +    GetEnumMembers();<br>
> +<br>
>      uint32_t<br>
>      GetNumberOfTemplateArguments ();<br>
><br>
> @@ -196,6 +199,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..9c447f1<br>
> --- /dev/null<br>
> +++ b/include/lldb/API/SBTypeEnumMember.h<br>
> @@ -0,0 +1,97 @@<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 f0dffe3..c8a039a 100644<br>
> --- a/include/lldb/Symbol/ClangASTType.h<br>
> +++ b/include/lldb/Symbol/ClangASTType.h<br>
> @@ -642,6 +642,9 @@ public:<br>
>      clang::ObjCInterfaceDecl *<br>
>      GetAsObjCInterfaceDecl () const;<br>
><br>
> +    clang::EnumDecl *<br>
> +    GetAsEnumDecl () const;<br>
> +<br>
>      void<br>
>      Clear()<br>
>      {<br>
> diff --git a/include/lldb/Symbol/Type.h b/include/lldb/Symbol/Type.h<br>
> index 50b22fe..0e8e5c7 100644<br>
> --- a/include/lldb/Symbol/Type.h<br>
> +++ b/include/lldb/Symbol/Type.h<br>
> @@ -589,7 +589,104 @@ protected:<br>
>      bool m_is_bitfield;<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 e06044b..754a2d8 100644<br>
> --- a/include/lldb/lldb-forward.h<br>
> +++ b/include/lldb/lldb-forward.h<br>
> @@ -233,6 +233,8 @@ class   TypeAndOrName;<br>
>  class   TypeList;<br>
>  class   TypeListImpl;<br>
>  class   TypeMemberImpl;<br>
> +class   TypeEnumMemberImpl;<br>
> +class   TypeEnumMemberListImpl;<br>
>  class   TypeNameSpecifierImpl;<br>
>  class   UUID;<br>
>  class   Unwind;<br>
> @@ -360,6 +362,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 fbeed3e..95fe50a 100644<br>
> --- a/scripts/Python/interface/SBType.i<br>
> +++ b/scripts/Python/interface/SBType.i<br>
> @@ -210,6 +210,9 @@ public:<br>
>      lldb::SBTypeMember<br>
>      GetVirtualBaseClassAtIndex (uint32_t idx);<br>
><br>
> +    lldb::SBTypeEnumMemberList<br>
> +    GetEnumMembers();<br>
> +<br>
>      const char*<br>
>      GetName();<br>
><br>
> @@ -339,6 +342,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>
> @@ -351,6 +362,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 c4bc8b9..752dffb 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 6be699f..3d74996 100644<br>
> --- a/scripts/lldb.swig<br>
> +++ b/scripts/lldb.swig<br>
> @@ -91,6 +91,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>
> @@ -155,6 +156,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 ef70ad5..a5b26fe 100644<br>
> --- a/source/API/CMakeLists.txt<br>
> +++ b/source/API/CMakeLists.txt<br>
> @@ -40,6 +40,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 9e25477..d9ee7eb 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>
> @@ -352,6 +355,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().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->GetASTContext(), 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 da445d8..ee55f18 100644<br>
> --- a/source/Symbol/ClangASTType.cpp<br>
> +++ b/source/Symbol/ClangASTType.cpp<br>
> @@ -4307,6 +4307,15 @@ check_op_param (uint32_t op_kind, bool unary, bool binary, uint32_t num_params)<br>
>          return false;<br>
>  }<br>
><br>
> +clang::EnumDecl *<br>
> +ClangASTType::GetAsEnumDecl () const<br>
> +{<br>
> +    const EnumType *enum_type = dyn_cast<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 0af2359..20dc583 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>
> @@ -988,3 +990,12 @@ TypeImpl::GetName ()<br>
>          return m_clang_ast_type.GetConstTypeName();<br>
>      return ConstString();<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 a06259d..36b60f5 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.7.10.4<br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>