<div dir="ltr">bump</div><div class="gmail_extra"><br clear="all"><div>--<br>Russell Harmon</div>
<br><br><div class="gmail_quote">On Sat, Oct 26, 2013 at 7:32 AM, Russell Harmon <span dir="ltr"><<a href="mailto:russ@eatnumber1.com" target="_blank">russ@eatnumber1.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">Here ya' go. Let me know if it needs some changes.<div class="gmail_extra"><br clear="all"><div>--<br>Russell Harmon</div>
<div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">From 72332118f0c23360633f4ab4df8590e0451dd39b Mon Sep 17 00:00:00 2001</div><div class="gmail_extra">From: Russell Harmon <<a href="mailto:russ@eatnumber1.com" target="_blank">russ@eatnumber1.com</a>></div>
<div class="gmail_extra">Date: Sat, 26 Oct 2013 07:26:17 -0700</div><div class="gmail_extra">Subject: [PATCH] Add support for inspecting enum members.</div><div class="gmail_extra"><br></div><div class="gmail_extra">---</div>
<div class="gmail_extra"> include/lldb/API/SBDefines.h | 2 +</div><div class="gmail_extra"> include/lldb/API/SBStream.h | 1 +</div><div class="gmail_extra"> include/lldb/API/SBType.h | 5 +</div>
<div class="gmail_extra"> include/lldb/API/SBTypeEnumMember.h | 97 ++++++++++++++</div><div class="gmail_extra"> include/lldb/Core/ClangForward.h | 1 +</div><div class="gmail_extra"> include/lldb/Symbol/ClangASTType.h | 3 +</div>
<div class="gmail_extra"> include/lldb/Symbol/Type.h | 99 +++++++++++++-</div><div class="gmail_extra"> include/lldb/lldb-forward.h | 3 +</div><div class="gmail_extra"> scripts/Python/interface/SBType.i | 14 ++</div>
<div class="gmail_extra"> scripts/Python/interface/SBTypeEnumMember.i | 108 +++++++++++++++</div><div class="gmail_extra"> scripts/Python/python-extensions.swig | 14 ++</div><div class="gmail_extra"> scripts/lldb.swig | 2 +</div>
<div class="gmail_extra"> source/API/CMakeLists.txt | 1 +</div><div class="gmail_extra"> source/API/SBType.cpp | 24 ++++</div><div class="gmail_extra"> source/API/SBTypeEnumMember.cpp | 192 +++++++++++++++++++++++++++</div>
<div class="gmail_extra"> source/Symbol/ClangASTType.cpp | 9 ++</div><div class="gmail_extra"> source/Symbol/Type.cpp | 11 ++</div><div class="gmail_extra"> test/python_api/type/TestTypeList.py | 5 +</div>
<div class="gmail_extra"> test/python_api/type/main.cpp | 7 +-</div><div class="gmail_extra"> 19 files changed, 596 insertions(+), 2 deletions(-)</div><div class="gmail_extra"> create mode 100644 include/lldb/API/SBTypeEnumMember.h</div>
<div class="gmail_extra"> create mode 100644 scripts/Python/interface/SBTypeEnumMember.i</div><div class="gmail_extra"> create mode 100644 source/API/SBTypeEnumMember.cpp</div><div class="gmail_extra"><br></div><div class="gmail_extra">
diff --git a/include/lldb/API/SBDefines.h b/include/lldb/API/SBDefines.h</div><div class="gmail_extra">index 2cdf921..971e449 100644</div><div class="gmail_extra">--- a/include/lldb/API/SBDefines.h</div><div class="gmail_extra">
+++ b/include/lldb/API/SBDefines.h</div><div class="gmail_extra">@@ -67,6 +67,8 @@ class SBTarget;</div><div class="gmail_extra"> class SBThread;</div><div class="gmail_extra"> class SBType;</div><div class="gmail_extra">
class SBTypeCategory;</div><div class="gmail_extra">+class SBTypeEnumMember;</div><div class="gmail_extra">+class SBTypeEnumMemberList;</div><div class="gmail_extra"> class SBTypeFilter;</div><div class="gmail_extra"> class SBTypeFormat;</div>
<div class="gmail_extra"> class SBTypeNameSpecifier;</div><div class="gmail_extra">diff --git a/include/lldb/API/SBStream.h b/include/lldb/API/SBStream.h</div><div class="gmail_extra">index 038adf6..f77b7b7 100644</div><div class="gmail_extra">
--- a/include/lldb/API/SBStream.h</div><div class="gmail_extra">+++ b/include/lldb/API/SBStream.h</div><div class="gmail_extra">@@ -86,6 +86,7 @@ protected:</div><div class="gmail_extra"> friend class SBTarget;</div>
<div class="gmail_extra">
friend class SBThread;</div><div class="gmail_extra"> friend class SBType;</div><div class="gmail_extra">+ friend class SBTypeEnumMember;</div><div class="gmail_extra"> friend class SBTypeMember;</div><div class="gmail_extra">
friend class SBValue;</div><div class="gmail_extra"> friend class SBWatchpoint;</div><div class="gmail_extra">diff --git a/include/lldb/API/SBType.h b/include/lldb/API/SBType.h</div><div class="gmail_extra">index 3729b2f..1f9ec63 100644</div>
<div class="gmail_extra">--- a/include/lldb/API/SBType.h</div><div class="gmail_extra">+++ b/include/lldb/API/SBType.h</div><div class="gmail_extra">@@ -140,6 +140,9 @@ public:</div><div class="gmail_extra"> lldb::SBTypeMember</div>
<div class="gmail_extra"> GetVirtualBaseClassAtIndex (uint32_t idx);</div><div class="gmail_extra"> </div><div class="gmail_extra">+ lldb::SBTypeEnumMemberList</div><div class="gmail_extra">+ GetEnumMembers();</div>
<div class="gmail_extra">+</div><div class="gmail_extra"> uint32_t</div><div class="gmail_extra"> GetNumberOfTemplateArguments ();</div><div class="gmail_extra"> </div><div class="gmail_extra">@@ -196,6 +199,8 @@ protected:</div>
<div class="gmail_extra"> friend class SBFunction;</div><div class="gmail_extra"> friend class SBModule;</div><div class="gmail_extra"> friend class SBTarget;</div><div class="gmail_extra">+ friend class SBTypeEnumMember;</div>
<div class="gmail_extra">+ friend class SBTypeEnumMemberList;</div><div class="gmail_extra"> friend class SBTypeNameSpecifier;</div><div class="gmail_extra"> friend class SBTypeMember;</div><div class="gmail_extra">
friend class SBTypeList;</div><div class="gmail_extra">diff --git a/include/lldb/API/SBTypeEnumMember.h b/include/lldb/API/SBTypeEnumMember.h</div><div class="gmail_extra">new file mode 100644</div><div class="gmail_extra">
index 0000000..9c447f1</div><div class="gmail_extra">--- /dev/null</div><div class="gmail_extra">+++ b/include/lldb/API/SBTypeEnumMember.h</div><div class="gmail_extra">@@ -0,0 +1,97 @@</div><div class="gmail_extra">+//===-- SBTypeEnumMember.h --------------------------------------*- C++ -*-===//</div>
<div class="gmail_extra">+//</div><div class="gmail_extra">+// The LLVM Compiler Infrastructure</div><div class="gmail_extra">+//</div><div class="gmail_extra">+// This file is distributed under the University of Illinois Open Source</div>
<div class="gmail_extra">+// License. See LICENSE.TXT for details.</div><div class="gmail_extra">+//</div><div class="gmail_extra">+//===----------------------------------------------------------------------===//</div><div class="gmail_extra">
+</div><div class="gmail_extra">+#ifndef LLDB_SBTypeEnumMember_h_</div><div class="gmail_extra">+#define LLDB_SBTypeEnumMember_h_</div><div class="gmail_extra">+</div><div class="gmail_extra">+#include "lldb/API/SBDefines.h"</div>
<div class="gmail_extra">+</div><div class="gmail_extra">+namespace lldb {</div><div class="gmail_extra">+</div><div class="gmail_extra">+class SBTypeEnumMember</div><div class="gmail_extra">+{</div><div class="gmail_extra">
+public:</div><div class="gmail_extra">+ SBTypeEnumMember ();</div><div class="gmail_extra">+</div><div class="gmail_extra">+ SBTypeEnumMember (const SBTypeEnumMember& rhs);</div><div class="gmail_extra">+</div>
<div class="gmail_extra">+ ~SBTypeEnumMember();</div><div class="gmail_extra">+</div><div class="gmail_extra">+ SBTypeEnumMember&</div><div class="gmail_extra">+ operator = (const SBTypeEnumMember& rhs);</div>
<div class="gmail_extra">+</div><div class="gmail_extra">+ bool</div><div class="gmail_extra">+ IsValid() const;</div><div class="gmail_extra">+</div><div class="gmail_extra">+ int64_t</div><div class="gmail_extra">
+ GetValueAsSigned();</div><div class="gmail_extra">+</div><div class="gmail_extra">+ uint64_t</div><div class="gmail_extra">+ GetValueAsUnsigned();</div><div class="gmail_extra">+</div><div class="gmail_extra">
+ const char *</div>
<div class="gmail_extra">+ GetName ();</div><div class="gmail_extra">+</div><div class="gmail_extra">+ lldb::SBType</div><div class="gmail_extra">+ GetType ();</div><div class="gmail_extra">+</div><div class="gmail_extra">
+ bool</div><div class="gmail_extra">+ GetDescription (lldb::SBStream &description,</div><div class="gmail_extra">+ lldb::DescriptionLevel description_level);</div><div class="gmail_extra">+</div>
<div class="gmail_extra">+protected:</div><div class="gmail_extra">+ friend class SBType;</div><div class="gmail_extra">+ friend class SBTypeEnumMemberList;</div><div class="gmail_extra">+</div><div class="gmail_extra">
+ void</div><div class="gmail_extra">+ reset (lldb_private::TypeEnumMemberImpl *);</div><div class="gmail_extra">+</div><div class="gmail_extra">+ lldb_private::TypeEnumMemberImpl &</div><div class="gmail_extra">
+ ref ();</div><div class="gmail_extra">+</div><div class="gmail_extra">+ const lldb_private::TypeEnumMemberImpl &</div><div class="gmail_extra">+ ref () const;</div><div class="gmail_extra">+</div><div class="gmail_extra">
+ lldb::TypeEnumMemberImplSP m_opaque_sp;</div><div class="gmail_extra">+</div><div class="gmail_extra">+ SBTypeEnumMember (const lldb::TypeEnumMemberImplSP &);</div><div class="gmail_extra">+};</div><div class="gmail_extra">
+</div><div class="gmail_extra">+class SBTypeEnumMemberList</div><div class="gmail_extra">+{</div><div class="gmail_extra">+public:</div><div class="gmail_extra">+ SBTypeEnumMemberList();</div><div class="gmail_extra">
+</div><div class="gmail_extra">+ SBTypeEnumMemberList(const SBTypeEnumMemberList& rhs);</div><div class="gmail_extra">+</div><div class="gmail_extra">+ ~SBTypeEnumMemberList();</div><div class="gmail_extra">+</div>
<div class="gmail_extra">+ SBTypeEnumMemberList&</div><div class="gmail_extra">+ operator = (const SBTypeEnumMemberList& rhs);</div><div class="gmail_extra">+</div><div class="gmail_extra">+ bool</div><div class="gmail_extra">
+ IsValid();</div><div class="gmail_extra">+</div><div class="gmail_extra">+ void</div><div class="gmail_extra">+ Append (SBTypeEnumMember entry);</div><div class="gmail_extra">+</div><div class="gmail_extra">+ SBTypeEnumMember</div>
<div class="gmail_extra">+ GetTypeEnumMemberAtIndex (uint32_t index);</div><div class="gmail_extra">+</div><div class="gmail_extra">+ uint32_t</div><div class="gmail_extra">+ GetSize();</div><div class="gmail_extra">
+</div><div class="gmail_extra">+</div><div class="gmail_extra">+private:</div><div class="gmail_extra">+ std::unique_ptr<lldb_private::TypeEnumMemberListImpl> m_opaque_ap;</div><div class="gmail_extra">+};</div>
<div class="gmail_extra">+</div><div class="gmail_extra">+} // namespace lldb</div><div class="gmail_extra">+</div><div class="gmail_extra">+#endif // LLDB_SBTypeEnumMember_h_</div><div class="gmail_extra">diff --git a/include/lldb/Core/ClangForward.h b/include/lldb/Core/ClangForward.h</div>
<div class="gmail_extra">index 0b3f13a..ef7308d 100644</div><div class="gmail_extra">--- a/include/lldb/Core/ClangForward.h</div><div class="gmail_extra">+++ b/include/lldb/Core/ClangForward.h</div><div class="gmail_extra">
@@ -58,6 +58,7 @@ namespace clang</div><div class="gmail_extra"> class DiagnosticsEngine;</div><div class="gmail_extra"> class DiagnosticOptions;</div><div class="gmail_extra"> class EnumDecl;</div><div class="gmail_extra">
+ class EnumConstantDecl;</div><div class="gmail_extra"> class Expr;</div><div class="gmail_extra"> class ExternalASTSource;</div><div class="gmail_extra"> class ExtVectorElementExpr;</div><div class="gmail_extra">
diff --git a/include/lldb/Symbol/ClangASTType.h b/include/lldb/Symbol/ClangASTType.h</div><div class="gmail_extra">index f0dffe3..c8a039a 100644</div><div class="gmail_extra">--- a/include/lldb/Symbol/ClangASTType.h</div>
<div class="gmail_extra">+++ b/include/lldb/Symbol/ClangASTType.h</div><div class="gmail_extra">@@ -642,6 +642,9 @@ public:</div><div class="gmail_extra"> clang::ObjCInterfaceDecl *</div><div class="gmail_extra"> GetAsObjCInterfaceDecl () const;</div>
<div class="gmail_extra"> </div><div class="gmail_extra">+ clang::EnumDecl *</div><div class="gmail_extra">+ GetAsEnumDecl () const;</div><div class="gmail_extra">+</div><div class="gmail_extra"> void</div><div class="gmail_extra">
Clear()</div><div class="gmail_extra"> {</div><div class="gmail_extra">diff --git a/include/lldb/Symbol/Type.h b/include/lldb/Symbol/Type.h</div><div class="gmail_extra">index 50b22fe..0e8e5c7 100644</div><div class="gmail_extra">
--- a/include/lldb/Symbol/Type.h</div><div class="gmail_extra">+++ b/include/lldb/Symbol/Type.h</div><div class="gmail_extra">@@ -589,7 +589,104 @@ protected:</div><div class="gmail_extra"> bool m_is_bitfield;</div><div class="gmail_extra">
};</div><div class="gmail_extra"> </div><div class="gmail_extra">- </div><div class="gmail_extra">+class TypeEnumMemberImpl</div><div class="gmail_extra">+{</div><div class="gmail_extra">+public:</div><div class="gmail_extra">
+ TypeEnumMemberImpl () :</div><div class="gmail_extra">+ m_integer_type(),</div><div class="gmail_extra">+ m_name("<invalid>"),</div><div class="gmail_extra">+ m_value(),</div><div class="gmail_extra">
+ m_valid(false)</div><div class="gmail_extra">+ {</div><div class="gmail_extra">+ }</div><div class="gmail_extra">+</div><div class="gmail_extra">+ TypeEnumMemberImpl (const clang::EnumConstantDecl* enum_member_decl,</div>
<div class="gmail_extra">+ const lldb_private::ClangASTType& integer_type);</div><div class="gmail_extra">+</div><div class="gmail_extra">+ TypeEnumMemberImpl (const TypeEnumMemberImpl& rhs) :</div>
<div class="gmail_extra">+ m_integer_type(rhs.m_integer_type),</div><div class="gmail_extra">+ m_name(rhs.m_name),</div><div class="gmail_extra">+ m_value(rhs.m_value),</div><div class="gmail_extra">
+ m_valid(rhs.m_valid)</div>
<div class="gmail_extra">+ {</div><div class="gmail_extra">+ }</div><div class="gmail_extra">+</div><div class="gmail_extra">+ TypeEnumMemberImpl&</div><div class="gmail_extra">+ operator = (const TypeEnumMemberImpl& rhs);</div>
<div class="gmail_extra">+</div><div class="gmail_extra">+ bool</div><div class="gmail_extra">+ IsValid ()</div><div class="gmail_extra">+ {</div><div class="gmail_extra">+ return m_valid;</div><div class="gmail_extra">
+ }</div><div class="gmail_extra">+</div><div class="gmail_extra">+ const ConstString &</div><div class="gmail_extra">+ GetName () const</div><div class="gmail_extra">+ {</div><div class="gmail_extra">+ return m_name;</div>
<div class="gmail_extra">+ }</div><div class="gmail_extra">+</div><div class="gmail_extra">+ const lldb::TypeImplSP &</div><div class="gmail_extra">+ GetIntegerType () const</div><div class="gmail_extra">+ {</div>
<div class="gmail_extra">+ return m_integer_type;</div><div class="gmail_extra">+ }</div><div class="gmail_extra">+</div><div class="gmail_extra">+ uint64_t</div><div class="gmail_extra">+ GetValueAsUnsigned () const</div>
<div class="gmail_extra">+ {</div><div class="gmail_extra">+ return *m_value.getRawData();</div><div class="gmail_extra">+ }</div><div class="gmail_extra">+</div><div class="gmail_extra">+ int64_t</div><div class="gmail_extra">
+ GetValueAsSigned () const</div><div class="gmail_extra">+ {</div><div class="gmail_extra">+ return (int64_t) *m_value.getRawData();</div><div class="gmail_extra">+ }</div><div class="gmail_extra">+</div>
<div class="gmail_extra">+protected:</div><div class="gmail_extra">+ lldb::TypeImplSP m_integer_type;</div><div class="gmail_extra">+ ConstString m_name;</div><div class="gmail_extra">+ llvm::APSInt m_value;</div>
<div class="gmail_extra">+ bool m_valid;</div><div class="gmail_extra">+};</div><div class="gmail_extra">+</div><div class="gmail_extra">+class TypeEnumMemberListImpl</div><div class="gmail_extra">+{</div><div class="gmail_extra">
+public:</div><div class="gmail_extra">+ TypeEnumMemberListImpl() :</div><div class="gmail_extra">+ m_content()</div><div class="gmail_extra">+ {</div><div class="gmail_extra">+ }</div><div class="gmail_extra">
+</div><div class="gmail_extra">+ void</div><div class="gmail_extra">+ Append (const lldb::TypeEnumMemberImplSP& type)</div><div class="gmail_extra">+ {</div><div class="gmail_extra">+ m_content.push_back(type);</div>
<div class="gmail_extra">+ }</div><div class="gmail_extra">+</div><div class="gmail_extra">+ void</div><div class="gmail_extra">+ Append (const lldb_private::TypeEnumMemberListImpl& type_list);</div><div class="gmail_extra">
+</div><div class="gmail_extra">+ lldb::TypeEnumMemberImplSP</div><div class="gmail_extra">+ GetTypeEnumMemberAtIndex(size_t idx)</div><div class="gmail_extra">+ {</div><div class="gmail_extra">+ lldb::TypeEnumMemberImplSP enum_member;</div>
<div class="gmail_extra">+ if (idx < GetSize())</div><div class="gmail_extra">+ enum_member = m_content[idx];</div><div class="gmail_extra">+ return enum_member;</div><div class="gmail_extra">
+ }</div>
<div class="gmail_extra">+</div><div class="gmail_extra">+ size_t</div><div class="gmail_extra">+ GetSize()</div><div class="gmail_extra">+ {</div><div class="gmail_extra">+ return m_content.size();</div>
<div class="gmail_extra">
+ }</div><div class="gmail_extra">+</div><div class="gmail_extra">+private:</div><div class="gmail_extra">+ std::vector<lldb::TypeEnumMemberImplSP> m_content;</div><div class="gmail_extra">+};</div><div class="gmail_extra">
+</div><div class="gmail_extra"> } // namespace lldb_private</div><div class="gmail_extra"> </div><div class="gmail_extra"> #endif // liblldb_Type_h_</div><div class="gmail_extra">diff --git a/include/lldb/lldb-forward.h b/include/lldb/lldb-forward.h</div>
<div class="gmail_extra">index e06044b..754a2d8 100644</div><div class="gmail_extra">--- a/include/lldb/lldb-forward.h</div><div class="gmail_extra">+++ b/include/lldb/lldb-forward.h</div><div class="gmail_extra">@@ -233,6 +233,8 @@ class TypeAndOrName;</div>
<div class="gmail_extra"> class TypeList;</div><div class="gmail_extra"> class TypeListImpl;</div><div class="gmail_extra"> class TypeMemberImpl;</div><div class="gmail_extra">+class TypeEnumMemberImpl;</div><div class="gmail_extra">
+class TypeEnumMemberListImpl;</div><div class="gmail_extra"> class TypeNameSpecifierImpl;</div><div class="gmail_extra"> class UUID;</div><div class="gmail_extra"> class Unwind;</div><div class="gmail_extra">@@ -360,6 +362,7 @@ namespace lldb {</div>
<div class="gmail_extra"> typedef std::weak_ptr<lldb_private::Type> TypeWP;</div><div class="gmail_extra"> typedef std::shared_ptr<lldb_private::TypeCategoryImpl> TypeCategoryImplSP;</div><div class="gmail_extra">
typedef std::shared_ptr<lldb_private::TypeImpl> TypeImplSP;</div><div class="gmail_extra">+ typedef std::shared_ptr<lldb_private::TypeEnumMemberImpl> TypeEnumMemberImplSP;</div><div class="gmail_extra">
typedef std::shared_ptr<lldb_private::TypeFilterImpl> TypeFilterImplSP;</div><div class="gmail_extra"> typedef std::shared_ptr<lldb_private::TypeFormatImpl> TypeFormatImplSP;</div><div class="gmail_extra">
typedef std::shared_ptr<lldb_private::TypeNameSpecifierImpl> TypeNameSpecifierImplSP;</div><div class="gmail_extra">diff --git a/scripts/Python/interface/SBType.i b/scripts/Python/interface/SBType.i</div><div class="gmail_extra">
index fbeed3e..95fe50a 100644</div><div class="gmail_extra">--- a/scripts/Python/interface/SBType.i</div><div class="gmail_extra">+++ b/scripts/Python/interface/SBType.i</div><div class="gmail_extra">@@ -210,6 +210,9 @@ public:</div>
<div class="gmail_extra"> lldb::SBTypeMember</div><div class="gmail_extra"> GetVirtualBaseClassAtIndex (uint32_t idx);</div><div class="gmail_extra"> </div><div class="gmail_extra">+ lldb::SBTypeEnumMemberList</div>
<div class="gmail_extra">+ GetEnumMembers();</div><div class="gmail_extra">+</div><div class="gmail_extra"> const char*</div><div class="gmail_extra"> GetName();</div><div class="gmail_extra"> </div><div class="gmail_extra">
@@ -339,6 +342,14 @@ public:</div><div class="gmail_extra"> members.append(field)</div><div class="gmail_extra"> return members</div><div class="gmail_extra"> </div><div class="gmail_extra">
+ def get_enum_members_array(self):</div><div class="gmail_extra">+ '''An accessor function that returns a list() that contains all enum members in an lldb.SBType object.'''</div>
<div class="gmail_extra">+ enum_members_list = []</div><div class="gmail_extra">+ sb_enum_members = self.GetEnumMembers()</div><div class="gmail_extra">+ for idx in range(sb_enum_members.GetSize()):</div>
<div class="gmail_extra">+ enum_members_list.append(sb_enum_members.GetTypeEnumMemberAtIndex(idx))</div><div class="gmail_extra">+ return enum_members_list</div><div class="gmail_extra">+</div><div class="gmail_extra">
__swig_getmethods__["bases"] = get_bases_array</div><div class="gmail_extra"> 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.''')</div>
<div class="gmail_extra"> </div><div class="gmail_extra">@@ -351,6 +362,9 @@ public:</div><div class="gmail_extra"> __swig_getmethods__["members"] = get_members_array</div><div class="gmail_extra">
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.''')</div>
<div class="gmail_extra"> </div><div class="gmail_extra">+ __swig_getmethods__["enum_members"] = get_enum_members_array</div><div class="gmail_extra">+ 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.''')</div>
<div class="gmail_extra">+</div><div class="gmail_extra"> %}</div><div class="gmail_extra"> </div><div class="gmail_extra"> };</div><div class="gmail_extra">diff --git a/scripts/Python/interface/SBTypeEnumMember.i b/scripts/Python/interface/SBTypeEnumMember.i</div>
<div class="gmail_extra">new file mode 100644</div><div class="gmail_extra">index 0000000..02d89f1</div><div class="gmail_extra">--- /dev/null</div><div class="gmail_extra">+++ b/scripts/Python/interface/SBTypeEnumMember.i</div>
<div class="gmail_extra">@@ -0,0 +1,108 @@</div><div class="gmail_extra">+//===-- SWIG Interface for SBTypeEnumMember ---------------------*- C++ -*-===//</div><div class="gmail_extra">+//</div><div class="gmail_extra">+// The LLVM Compiler Infrastructure</div>
<div class="gmail_extra">+//</div><div class="gmail_extra">+// This file is distributed under the University of Illinois Open Source</div><div class="gmail_extra">+// License. See LICENSE.TXT for details.</div><div class="gmail_extra">
+//</div><div class="gmail_extra">+//===----------------------------------------------------------------------===//</div><div class="gmail_extra">+</div><div class="gmail_extra">+namespace lldb {</div><div class="gmail_extra">
+</div><div class="gmail_extra">+%feature(</div><div class="gmail_extra">+ "docstring",</div><div class="gmail_extra">+ "Represents a member of an enum in lldb."</div><div class="gmail_extra">+) SBTypeEnumMember;</div>
<div class="gmail_extra">+</div><div class="gmail_extra">+class SBTypeEnumMember</div><div class="gmail_extra">+{</div><div class="gmail_extra">+public:</div><div class="gmail_extra">+ SBTypeEnumMember ();</div><div class="gmail_extra">
+</div><div class="gmail_extra">+ SBTypeEnumMember (const SBTypeEnumMember& rhs);</div><div class="gmail_extra">+</div><div class="gmail_extra">+ ~SBTypeEnumMember();</div><div class="gmail_extra">+</div><div class="gmail_extra">
+ bool</div><div class="gmail_extra">+ IsValid() const;</div><div class="gmail_extra">+</div><div class="gmail_extra">+ int64_t</div><div class="gmail_extra">+ GetValueAsSigned();</div><div class="gmail_extra">
+</div><div class="gmail_extra">+ uint64_t</div><div class="gmail_extra">+ GetValueAsUnsigned();</div><div class="gmail_extra">+</div><div class="gmail_extra">+ const char *</div><div class="gmail_extra">+ GetName ();</div>
<div class="gmail_extra">+</div><div class="gmail_extra">+ lldb::SBType</div><div class="gmail_extra">+ GetType ();</div><div class="gmail_extra">+</div><div class="gmail_extra">+ bool</div><div class="gmail_extra">
+ GetDescription (lldb::SBStream &description,</div><div class="gmail_extra">+ lldb::DescriptionLevel description_level);</div><div class="gmail_extra">+</div><div class="gmail_extra">+ %pythoncode %{</div>
<div class="gmail_extra">+ __swig_getmethods__["name"] = GetName</div><div class="gmail_extra">+ if _newclass: name = property(GetName, None, doc='''A read only property that returns the name for this enum member as a string.''')</div>
<div class="gmail_extra">+</div><div class="gmail_extra">+ __swig_getmethods__["type"] = GetType</div><div class="gmail_extra">+ 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.''')</div>
<div class="gmail_extra">+</div><div class="gmail_extra">+ __swig_getmethods__["signed"] = GetValueAsSigned</div><div class="gmail_extra">+ if _newclass: signed = property(GetValueAsSigned, None, doc='''A read only property that returns the value of this enum member as a signed integer.''')</div>
<div class="gmail_extra">+</div><div class="gmail_extra">+ __swig_getmethods__["unsigned"] = GetValueAsUnsigned</div><div class="gmail_extra">+ if _newclass: unsigned = property(GetValueAsUnsigned, None, doc='''A read only property that returns the value of this enum member as a unsigned integer.''')</div>
<div class="gmail_extra">+ %}</div><div class="gmail_extra">+</div><div class="gmail_extra">+protected:</div><div class="gmail_extra">+ friend class SBType;</div><div class="gmail_extra">+ friend class SBTypeEnumMemberList;</div>
<div class="gmail_extra">+</div><div class="gmail_extra">+ void</div><div class="gmail_extra">+ reset (lldb_private::TypeEnumMemberImpl *);</div><div class="gmail_extra">+</div><div class="gmail_extra">+ lldb_private::TypeEnumMemberImpl &</div>
<div class="gmail_extra">+ ref ();</div><div class="gmail_extra">+</div><div class="gmail_extra">+ const lldb_private::TypeEnumMemberImpl &</div><div class="gmail_extra">+ ref () const;</div><div class="gmail_extra">
+</div><div class="gmail_extra">+ lldb::TypeEnumMemberImplSP m_opaque_sp;</div><div class="gmail_extra">+</div><div class="gmail_extra">+ SBTypeEnumMember (const lldb::TypeEnumMemberImplSP &);</div><div class="gmail_extra">
+};</div><div class="gmail_extra">+</div><div class="gmail_extra">+%feature(</div><div class="gmail_extra">+ "docstring",</div><div class="gmail_extra">+ "Represents a list of SBTypeEnumMembers."</div>
<div class="gmail_extra">+) SBTypeEnumMemberList;</div><div class="gmail_extra">+</div><div class="gmail_extra">+class SBTypeEnumMemberList</div><div class="gmail_extra">+{</div><div class="gmail_extra">+public:</div><div class="gmail_extra">
+ SBTypeEnumMemberList();</div><div class="gmail_extra">+</div><div class="gmail_extra">+ SBTypeEnumMemberList(const SBTypeEnumMemberList& rhs);</div><div class="gmail_extra">+</div><div class="gmail_extra">+ ~SBTypeEnumMemberList();</div>
<div class="gmail_extra">+</div><div class="gmail_extra">+ bool</div><div class="gmail_extra">+ IsValid();</div><div class="gmail_extra">+</div><div class="gmail_extra">+ void</div><div class="gmail_extra">+ Append (SBTypeEnumMember entry);</div>
<div class="gmail_extra">+</div><div class="gmail_extra">+ SBTypeEnumMember</div><div class="gmail_extra">+ GetTypeEnumMemberAtIndex (uint32_t index);</div><div class="gmail_extra">+</div><div class="gmail_extra">+ uint32_t</div>
<div class="gmail_extra">+ GetSize();</div><div class="gmail_extra">+</div><div class="gmail_extra">+</div><div class="gmail_extra">+private:</div><div class="gmail_extra">+ std::unique_ptr<lldb_private::TypeEnumMemberListImpl> m_opaque_ap;</div>
<div class="gmail_extra">+};</div><div class="gmail_extra">+</div><div class="gmail_extra">+} // namespace lldb</div><div class="gmail_extra">diff --git a/scripts/Python/python-extensions.swig b/scripts/Python/python-extensions.swig</div>
<div class="gmail_extra">index c4bc8b9..752dffb 100644</div><div class="gmail_extra">--- a/scripts/Python/python-extensions.swig</div><div class="gmail_extra">+++ b/scripts/Python/python-extensions.swig</div><div class="gmail_extra">
@@ -608,6 +608,20 @@</div><div class="gmail_extra"> return PyString_FromString("");</div><div class="gmail_extra"> }</div><div class="gmail_extra"> }</div><div class="gmail_extra">+%extend lldb::SBTypeEnumMember {</div>
<div class="gmail_extra">+ PyObject *lldb::SBTypeEnumMember::__str__ (){</div><div class="gmail_extra">+ lldb::SBStream description;</div><div class="gmail_extra">+ $self->GetDescription (description, lldb::eDescriptionLevelBrief);</div>
<div class="gmail_extra">+ const char *desc = description.GetData();</div><div class="gmail_extra">+ size_t desc_len = description.GetSize();</div><div class="gmail_extra">+ if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r'))</div>
<div class="gmail_extra">+ --desc_len;</div><div class="gmail_extra">+ if (desc_len > 0)</div><div class="gmail_extra">+ return PyString_FromStringAndSize (desc, desc_len);</div>
<div class="gmail_extra">+ else</div><div class="gmail_extra">+ return PyString_FromString("");</div><div class="gmail_extra">+ }</div><div class="gmail_extra">+}</div><div class="gmail_extra">
%extend lldb::SBTypeNameSpecifier {</div><div class="gmail_extra"> PyObject *lldb::SBTypeNameSpecifier::__str__ (){</div><div class="gmail_extra"> lldb::SBStream description;</div><div class="gmail_extra">
diff --git a/scripts/lldb.swig b/scripts/lldb.swig</div><div class="gmail_extra">index 6be699f..3d74996 100644</div><div class="gmail_extra">--- a/scripts/lldb.swig</div><div class="gmail_extra">+++ b/scripts/lldb.swig</div>
<div class="gmail_extra">@@ -91,6 +91,7 @@ import os</div><div class="gmail_extra"> #include "lldb/API/SBThread.h"</div><div class="gmail_extra"> #include "lldb/API/SBType.h"</div><div class="gmail_extra">
#include "lldb/API/SBTypeCategory.h"</div><div class="gmail_extra">+#include "lldb/API/SBTypeEnumMember.h"</div><div class="gmail_extra"> #include "lldb/API/SBTypeFilter.h"</div><div class="gmail_extra">
#include "lldb/API/SBTypeFormat.h"</div><div class="gmail_extra"> #include "lldb/API/SBTypeNameSpecifier.h"</div><div class="gmail_extra">@@ -155,6 +156,7 @@ import os</div><div class="gmail_extra"> %include "./Python/interface/SBThread.i"</div>
<div class="gmail_extra"> %include "./Python/interface/SBType.i"</div><div class="gmail_extra"> %include "./Python/interface/SBTypeCategory.i"</div><div class="gmail_extra">+%include "./Python/interface/SBTypeEnumMember.i"</div>
<div class="gmail_extra"> %include "./Python/interface/SBTypeFilter.i"</div><div class="gmail_extra"> %include "./Python/interface/SBTypeFormat.i"</div><div class="gmail_extra"> %include "./Python/interface/SBTypeNameSpecifier.i"</div>
<div class="gmail_extra">diff --git a/source/API/CMakeLists.txt b/source/API/CMakeLists.txt</div><div class="gmail_extra">index ef70ad5..a5b26fe 100644</div><div class="gmail_extra">--- a/source/API/CMakeLists.txt</div><div class="gmail_extra">
+++ b/source/API/CMakeLists.txt</div><div class="gmail_extra">@@ -40,6 +40,7 @@ add_lldb_library(lldbAPI</div><div class="gmail_extra"> SBThread.cpp</div><div class="gmail_extra"> SBType.cpp</div><div class="gmail_extra">
SBTypeCategory.cpp</div><div class="gmail_extra">+ SBTypeEnumMember.cpp</div><div class="gmail_extra"> SBTypeFilter.cpp</div><div class="gmail_extra"> SBTypeFormat.cpp</div><div class="gmail_extra"> SBTypeNameSpecifier.cpp</div>
<div class="gmail_extra">diff --git a/source/API/SBType.cpp b/source/API/SBType.cpp</div><div class="gmail_extra">index 9e25477..d9ee7eb 100644</div><div class="gmail_extra">--- a/source/API/SBType.cpp</div><div class="gmail_extra">
+++ b/source/API/SBType.cpp</div><div class="gmail_extra">@@ -9,6 +9,7 @@</div><div class="gmail_extra"> </div><div class="gmail_extra"> #include "lldb/API/SBDefines.h"</div><div class="gmail_extra"> #include "lldb/API/SBType.h"</div>
<div class="gmail_extra">+#include "lldb/API/SBTypeEnumMember.h"</div><div class="gmail_extra"> #include "lldb/API/SBStream.h"</div><div class="gmail_extra"> #include "lldb/Core/ConstString.h"</div>
<div class="gmail_extra"> #include "lldb/Core/Log.h"</div><div class="gmail_extra">@@ -17,6 +18,8 @@</div><div class="gmail_extra"> #include "lldb/Symbol/ClangASTType.h"</div><div class="gmail_extra">
#include "lldb/Symbol/Type.h"</div>
<div class="gmail_extra"> </div><div class="gmail_extra">+#include "clang/AST/Decl.h"</div><div class="gmail_extra">+</div><div class="gmail_extra"> using namespace lldb;</div><div class="gmail_extra"> using namespace lldb_private;</div>
<div class="gmail_extra"> using namespace clang;</div><div class="gmail_extra">@@ -352,6 +355,27 @@ SBType::GetVirtualBaseClassAtIndex (uint32_t idx)</div><div class="gmail_extra"> return sb_type_member;</div><div class="gmail_extra">
}</div><div class="gmail_extra"> </div><div class="gmail_extra">+SBTypeEnumMemberList</div><div class="gmail_extra">+SBType::GetEnumMembers ()</div><div class="gmail_extra">+{</div><div class="gmail_extra">+ SBTypeEnumMemberList sb_enum_member_list;</div>
<div class="gmail_extra">+ if (IsValid())</div><div class="gmail_extra">+ {</div><div class="gmail_extra">+ const clang::EnumDecl *enum_decl = m_opaque_sp->GetClangASTType().GetFullyUnqualifiedType().GetAsEnumDecl();</div>
<div class="gmail_extra">+ if (enum_decl)</div><div class="gmail_extra">+ {</div><div class="gmail_extra">+ clang::EnumDecl::enumerator_iterator enum_pos, enum_end_pos;</div><div class="gmail_extra">
+ for (enum_pos = enum_decl->enumerator_begin(), enum_end_pos = enum_decl->enumerator_end(); enum_pos != enum_end_pos; ++enum_pos)</div><div class="gmail_extra">+ {</div><div class="gmail_extra">
+ SBTypeEnumMember enum_member;</div><div class="gmail_extra">+ enum_member.reset(new TypeEnumMemberImpl(*enum_pos, ClangASTType(m_opaque_sp->GetASTContext(), enum_decl->getIntegerType())));</div>
<div class="gmail_extra">+ sb_enum_member_list.Append(enum_member);</div><div class="gmail_extra">+ }</div><div class="gmail_extra">+ }</div><div class="gmail_extra">+ }</div><div class="gmail_extra">
+ return sb_enum_member_list;</div><div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra"> SBTypeMember</div><div class="gmail_extra"> SBType::GetFieldAtIndex (uint32_t idx)</div><div class="gmail_extra">
{</div><div class="gmail_extra">diff --git a/source/API/SBTypeEnumMember.cpp b/source/API/SBTypeEnumMember.cpp</div><div class="gmail_extra">new file mode 100644</div><div class="gmail_extra">index 0000000..47c57dd</div>
<div class="gmail_extra">--- /dev/null</div><div class="gmail_extra">+++ b/source/API/SBTypeEnumMember.cpp</div><div class="gmail_extra">@@ -0,0 +1,192 @@</div><div class="gmail_extra">+//===-- SBTypeEnumMember.cpp ---------------------------------- -*- C++ -*-===//</div>
<div class="gmail_extra">+//</div><div class="gmail_extra">+// The LLVM Compiler Infrastructure</div><div class="gmail_extra">+//</div><div class="gmail_extra">+// This file is distributed under the University of Illinois Open Source</div>
<div class="gmail_extra">+// License. See LICENSE.TXT for details.</div><div class="gmail_extra">+//</div><div class="gmail_extra">+//===----------------------------------------------------------------------===//</div><div class="gmail_extra">
+</div><div class="gmail_extra">+#include "lldb/API/SBDefines.h"</div><div class="gmail_extra">+#include "lldb/API/SBType.h"</div><div class="gmail_extra">+#include "lldb/API/SBTypeEnumMember.h"</div>
<div class="gmail_extra">+#include "lldb/API/SBStream.h"</div><div class="gmail_extra">+#include "lldb/Core/Stream.h"</div><div class="gmail_extra">+#include "lldb/Symbol/ClangASTType.h"</div>
<div class="gmail_extra">+#include "lldb/Symbol/Type.h"</div><div class="gmail_extra">+</div><div class="gmail_extra">+using namespace lldb;</div><div class="gmail_extra">+using namespace lldb_private;</div><div class="gmail_extra">
+using namespace clang;</div><div class="gmail_extra">+</div><div class="gmail_extra">+SBTypeEnumMember::SBTypeEnumMember() :</div><div class="gmail_extra">+ m_opaque_sp()</div><div class="gmail_extra">+{</div><div class="gmail_extra">
+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+SBTypeEnumMember::~SBTypeEnumMember()</div><div class="gmail_extra">+{</div><div class="gmail_extra">+}</div><div class="gmail_extra">+SBTypeEnumMember::SBTypeEnumMember (const lldb::TypeEnumMemberImplSP &enum_member_sp) :</div>
<div class="gmail_extra">+ m_opaque_sp(enum_member_sp)</div><div class="gmail_extra">+{</div><div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+SBTypeEnumMember::SBTypeEnumMember (const SBTypeEnumMember& rhs) :</div>
<div class="gmail_extra">+ m_opaque_sp()</div><div class="gmail_extra">+{</div><div class="gmail_extra">+ if (this != &rhs)</div><div class="gmail_extra">+ {</div><div class="gmail_extra">+ if (rhs.IsValid())</div>
<div class="gmail_extra">+ m_opaque_sp.reset(new TypeEnumMemberImpl(rhs.ref()));</div><div class="gmail_extra">+ }</div><div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra">
+SBTypeEnumMember&</div><div class="gmail_extra">+SBTypeEnumMember::operator = (const SBTypeEnumMember& rhs)</div><div class="gmail_extra">+{</div><div class="gmail_extra">+ if (this != &rhs)</div><div class="gmail_extra">
+ {</div><div class="gmail_extra">+ if (rhs.IsValid())</div><div class="gmail_extra">+ m_opaque_sp.reset(new TypeEnumMemberImpl(rhs.ref()));</div><div class="gmail_extra">+ }</div><div class="gmail_extra">
+ return *this;</div><div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+bool</div><div class="gmail_extra">+SBTypeEnumMember::IsValid() const</div><div class="gmail_extra">+{</div>
<div class="gmail_extra">+ return m_opaque_sp.get();</div><div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+const char *</div><div class="gmail_extra">+SBTypeEnumMember::GetName ()</div>
<div class="gmail_extra">+{</div><div class="gmail_extra">+ if (m_opaque_sp.get())</div><div class="gmail_extra">+ return m_opaque_sp->GetName().GetCString();</div><div class="gmail_extra">+ return NULL;</div>
<div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+int64_t</div><div class="gmail_extra">+SBTypeEnumMember::GetValueAsSigned()</div><div class="gmail_extra">+{</div><div class="gmail_extra">
+ if (m_opaque_sp.get())</div><div class="gmail_extra">+ return m_opaque_sp->GetValueAsSigned();</div><div class="gmail_extra">+ return 0;</div><div class="gmail_extra">+}</div><div class="gmail_extra">+</div>
<div class="gmail_extra">+uint64_t</div><div class="gmail_extra">+SBTypeEnumMember::GetValueAsUnsigned()</div><div class="gmail_extra">+{</div><div class="gmail_extra">+ if (m_opaque_sp.get())</div><div class="gmail_extra">
+ return m_opaque_sp->GetValueAsUnsigned();</div><div class="gmail_extra">+ return 0;</div><div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+SBType</div><div class="gmail_extra">
+SBTypeEnumMember::GetType ()</div><div class="gmail_extra">+{</div><div class="gmail_extra">+ SBType sb_type;</div><div class="gmail_extra">+ if (m_opaque_sp.get())</div><div class="gmail_extra">+ {</div><div class="gmail_extra">
+ sb_type.SetSP(m_opaque_sp->GetIntegerType());</div><div class="gmail_extra">+ }</div><div class="gmail_extra">+ return sb_type;</div><div class="gmail_extra">+</div><div class="gmail_extra">+}</div><div class="gmail_extra">
+</div><div class="gmail_extra">+void</div><div class="gmail_extra">+SBTypeEnumMember::reset(TypeEnumMemberImpl *type_member_impl)</div><div class="gmail_extra">+{</div><div class="gmail_extra">+ m_opaque_sp.reset(type_member_impl);</div>
<div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+TypeEnumMemberImpl &</div><div class="gmail_extra">+SBTypeEnumMember::ref ()</div><div class="gmail_extra">+{</div><div class="gmail_extra">
+ if (m_opaque_sp.get() == NULL)</div><div class="gmail_extra">+ m_opaque_sp.reset (new TypeEnumMemberImpl());</div><div class="gmail_extra">+ return *m_opaque_sp.get();</div><div class="gmail_extra">+}</div>
<div class="gmail_extra">+</div><div class="gmail_extra">+const TypeEnumMemberImpl &</div><div class="gmail_extra">+SBTypeEnumMember::ref () const</div><div class="gmail_extra">+{</div><div class="gmail_extra">+ return *m_opaque_sp.get();</div>
<div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+</div><div class="gmail_extra">+SBTypeEnumMemberList::SBTypeEnumMemberList() :</div><div class="gmail_extra">+ m_opaque_ap(new TypeEnumMemberListImpl())</div>
<div class="gmail_extra">+{</div><div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+SBTypeEnumMemberList::SBTypeEnumMemberList(const SBTypeEnumMemberList& rhs) :</div><div class="gmail_extra">
+ m_opaque_ap(new TypeEnumMemberListImpl())</div><div class="gmail_extra">+{</div><div class="gmail_extra">+ for (uint32_t i = 0, rhs_size = const_cast<SBTypeEnumMemberList&>(rhs).GetSize(); i < rhs_size; i++)</div>
<div class="gmail_extra">+ Append(const_cast<SBTypeEnumMemberList&>(rhs).GetTypeEnumMemberAtIndex(i));</div><div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+bool</div>
<div class="gmail_extra">+SBTypeEnumMemberList::IsValid ()</div><div class="gmail_extra">+{</div><div class="gmail_extra">+ return (m_opaque_ap.get() != NULL);</div><div class="gmail_extra">+}</div><div class="gmail_extra">
+</div><div class="gmail_extra">+SBTypeEnumMemberList&</div><div class="gmail_extra">+SBTypeEnumMemberList::operator = (const SBTypeEnumMemberList& rhs)</div><div class="gmail_extra">+{</div><div class="gmail_extra">
+ if (this != &rhs)</div><div class="gmail_extra">+ {</div><div class="gmail_extra">+ m_opaque_ap.reset (new TypeEnumMemberListImpl());</div><div class="gmail_extra">+ for (uint32_t i = 0, rhs_size = const_cast<SBTypeEnumMemberList&>(rhs).GetSize(); i < rhs_size; i++)</div>
<div class="gmail_extra">+ Append(const_cast<SBTypeEnumMemberList&>(rhs).GetTypeEnumMemberAtIndex(i));</div><div class="gmail_extra">+ }</div><div class="gmail_extra">+ return *this;</div><div class="gmail_extra">
+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+void</div><div class="gmail_extra">+SBTypeEnumMemberList::Append (SBTypeEnumMember enum_member)</div><div class="gmail_extra">+{</div><div class="gmail_extra">
+ if (enum_member.IsValid())</div><div class="gmail_extra">+ m_opaque_ap->Append (enum_member.m_opaque_sp);</div><div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+SBTypeEnumMember</div>
<div class="gmail_extra">+SBTypeEnumMemberList::GetTypeEnumMemberAtIndex(uint32_t index)</div><div class="gmail_extra">+{</div><div class="gmail_extra">+ if (m_opaque_ap.get())</div><div class="gmail_extra">+ return SBTypeEnumMember(m_opaque_ap->GetTypeEnumMemberAtIndex(index));</div>
<div class="gmail_extra">+ return SBTypeEnumMember();</div><div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+uint32_t</div><div class="gmail_extra">+SBTypeEnumMemberList::GetSize()</div>
<div class="gmail_extra">+{</div><div class="gmail_extra">+ return m_opaque_ap->GetSize();</div><div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+SBTypeEnumMemberList::~SBTypeEnumMemberList()</div>
<div class="gmail_extra">+{</div><div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra">+bool</div><div class="gmail_extra">+SBTypeEnumMember::GetDescription (lldb::SBStream &description, </div>
<div class="gmail_extra">+ lldb::DescriptionLevel description_level)</div><div class="gmail_extra">+{</div><div class="gmail_extra">+ Stream &strm = description.ref();</div><div class="gmail_extra">
+</div><div class="gmail_extra">+ if (m_opaque_sp.get())</div><div class="gmail_extra">+ {</div><div class="gmail_extra">+ if( m_opaque_sp->GetIntegerType()->GetDescription(strm, description_level) )</div>
<div class="gmail_extra">+ {</div><div class="gmail_extra">+ strm.Printf(" %s", m_opaque_sp->GetName().GetCString());</div><div class="gmail_extra">+ }</div><div class="gmail_extra">
+ }</div>
<div class="gmail_extra">+ else</div><div class="gmail_extra">+ {</div><div class="gmail_extra">+ strm.PutCString ("No value");</div><div class="gmail_extra">+ }</div><div class="gmail_extra">+ return true;</div>
<div class="gmail_extra">+}</div><div class="gmail_extra">diff --git a/source/Symbol/ClangASTType.cpp b/source/Symbol/ClangASTType.cpp</div><div class="gmail_extra">index da445d8..ee55f18 100644</div><div class="gmail_extra">
--- a/source/Symbol/ClangASTType.cpp</div><div class="gmail_extra">+++ b/source/Symbol/ClangASTType.cpp</div><div class="gmail_extra">@@ -4307,6 +4307,15 @@ check_op_param (uint32_t op_kind, bool unary, bool binary, uint32_t num_params)</div>
<div class="gmail_extra"> return false;</div><div class="gmail_extra"> }</div><div class="gmail_extra"> </div><div class="gmail_extra">+clang::EnumDecl *</div><div class="gmail_extra">+ClangASTType::GetAsEnumDecl () const</div>
<div class="gmail_extra">+{</div><div class="gmail_extra">+ const EnumType *enum_type = dyn_cast<EnumType>(GetCanonicalQualType());</div><div class="gmail_extra">+ if (enum_type)</div><div class="gmail_extra">
+ return enum_type->getDecl();</div><div class="gmail_extra">+ return NULL;</div><div class="gmail_extra">+}</div><div class="gmail_extra">+</div><div class="gmail_extra"> clang::RecordDecl *</div><div class="gmail_extra">
ClangASTType::GetAsRecordDecl () const</div><div class="gmail_extra"> {</div><div class="gmail_extra">diff --git a/source/Symbol/Type.cpp b/source/Symbol/Type.cpp</div><div class="gmail_extra">index 0af2359..20dc583 100644</div>
<div class="gmail_extra">--- a/source/Symbol/Type.cpp</div><div class="gmail_extra">+++ b/source/Symbol/Type.cpp</div><div class="gmail_extra">@@ -30,6 +30,8 @@</div><div class="gmail_extra"> </div><div class="gmail_extra">
#include "llvm/ADT/StringRef.h"</div><div class="gmail_extra"> </div><div class="gmail_extra">+#include "clang/AST/Decl.h"</div><div class="gmail_extra">+</div><div class="gmail_extra"> using namespace lldb;</div>
<div class="gmail_extra"> using namespace lldb_private;</div><div class="gmail_extra"> </div><div class="gmail_extra">@@ -988,3 +990,12 @@ TypeImpl::GetName ()</div><div class="gmail_extra"> return m_clang_ast_type.GetConstTypeName();</div>
<div class="gmail_extra"> return ConstString();</div><div class="gmail_extra"> }</div><div class="gmail_extra">+</div><div class="gmail_extra">+TypeEnumMemberImpl::TypeEnumMemberImpl (const clang::EnumConstantDecl* enum_member_decl,</div>
<div class="gmail_extra">+ const lldb_private::ClangASTType& integer_type) :</div><div class="gmail_extra">+ m_value(enum_member_decl->getInitVal()),</div><div class="gmail_extra">
+ m_integer_type(new TypeImpl(integer_type))</div><div class="gmail_extra">+{</div><div class="gmail_extra">+ m_name = ConstString(enum_member_decl->getNameAsString().c_str());</div><div class="gmail_extra">+ m_valid = true;</div>
<div class="gmail_extra">+}</div><div class="gmail_extra">diff --git a/test/python_api/type/TestTypeList.py b/test/python_api/type/TestTypeList.py</div><div class="gmail_extra">index a06259d..36b60f5 100644</div><div class="gmail_extra">
--- a/test/python_api/type/TestTypeList.py</div><div class="gmail_extra">+++ b/test/python_api/type/TestTypeList.py</div><div class="gmail_extra">@@ -70,6 +70,11 @@ class TypeAndTypeListTestCase(TestBase):</div><div class="gmail_extra">
for type in type_list:</div><div class="gmail_extra"> self.assertTrue(type)</div><div class="gmail_extra"> self.DebugSBType(type)</div><div class="gmail_extra">+ for field in type.fields:</div>
<div class="gmail_extra">+ if <a href="http://field.name" target="_blank">field.name</a> == "type":</div><div class="gmail_extra">+ for enum_member in field.type.enum_members:</div>
<div class="gmail_extra">
+ self.assertTrue(enum_member)</div><div class="gmail_extra">+ self.DebugSBType(enum_member.type)</div><div class="gmail_extra"> </div><div class="gmail_extra"> # Pass an empty string. LLDB should not crash. :-)</div>
<div class="gmail_extra"> fuzz_types = target.FindTypes(None)</div><div class="gmail_extra">diff --git a/test/python_api/type/main.cpp b/test/python_api/type/main.cpp</div><div class="gmail_extra">index db0e249..67b57ac 100644</div>
<div class="gmail_extra">--- a/test/python_api/type/main.cpp</div><div class="gmail_extra">+++ b/test/python_api/type/main.cpp</div><div class="gmail_extra">@@ -12,9 +12,14 @@ class Task {</div><div class="gmail_extra"> public:</div>
<div class="gmail_extra"> int id;</div><div class="gmail_extra"> Task *next;</div><div class="gmail_extra">+ enum {</div><div class="gmail_extra">+ TASK_TYPE_1,</div><div class="gmail_extra">+ TASK_TYPE_2</div>
<div class="gmail_extra">+ } type;</div><div class="gmail_extra"> Task(int i, Task *n):</div><div class="gmail_extra"> id(i),</div><div class="gmail_extra">- next(n)</div><div class="gmail_extra">+ next(n),</div>
<div class="gmail_extra">+ type(TASK_TYPE_1)</div><div class="gmail_extra"> {}</div><div class="gmail_extra"> };</div><span class="HOEnZb"><font color="#888888"><div class="gmail_extra"> </div><div class="gmail_extra">
-- </div><div class="gmail_extra">1.7.10.4</div>
<div class="gmail_extra"><br></div></font></span></div></div></div>
</blockquote></div><br></div>