diff options
Diffstat (limited to 'lldb/bindings/interface/SBTypeExtensions.i')
| -rw-r--r-- | lldb/bindings/interface/SBTypeExtensions.i | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lldb/bindings/interface/SBTypeExtensions.i b/lldb/bindings/interface/SBTypeExtensions.i index f40ca80e58c0..9c7d61497951 100644 --- a/lldb/bindings/interface/SBTypeExtensions.i +++ b/lldb/bindings/interface/SBTypeExtensions.i @@ -2,6 +2,11 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTypeMember, lldb::eDescriptionLevelBrief) %extend lldb::SBTypeMember { #ifdef SWIGPYTHON %pythoncode %{ + # operator== is a free function, which swig does not handle, so we inject + # our own equality operator here + def __eq__(self, other): + return not self.__ne__(other) + name = property(GetName, None, doc='''A read only property that returns the name for this member as a string.''') type = property(GetType, None, doc='''A read only property that returns an lldb object that represents the type (lldb.SBType) for this member.''') byte_offset = property(GetOffsetInBytes, None, doc='''A read only property that returns offset in bytes for this member as an integer.''') @@ -14,6 +19,18 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBTypeMember, lldb::eDescriptionLevelBrief) STRING_EXTENSION_LEVEL_OUTSIDE(SBTypeMemberFunction, lldb::eDescriptionLevelBrief) +%extend lldb::SBTypeMemberFunction { +#ifdef SWIGPYTHON + %pythoncode%{ + # operator== is a free function, which swig does not handle, so we inject + # our own equality operator here + def __eq__(self, other): + return not self.__ne__(other) + + %} +#endif +} + STRING_EXTENSION_LEVEL_OUTSIDE(SBType, lldb::eDescriptionLevelBrief) %extend lldb::SBType { @@ -28,6 +45,14 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBType, lldb::eDescriptionLevelBrief) return template_args return None + # operator== is a free function, which swig does not handle, so we inject + # our own equality operator here + def __eq__(self, other): + return not self.__ne__(other) + + def __len__(self): + return self.GetByteSize() + module = property(GetModule, None, doc='''A read only property that returns the module in which type is defined.''') name = property(GetName, None, doc='''A read only property that returns the name for this type as a string.''') size = property(GetByteSize, None, doc='''A read only property that returns size in bytes for this type as an integer.''') @@ -121,6 +146,11 @@ STRING_EXTENSION_LEVEL_OUTSIDE(SBType, lldb::eDescriptionLevelBrief) %extend lldb::SBTypeList { #ifdef SWIGPYTHON %pythoncode%{ + # operator== is a free function, which swig does not handle, so we inject + # our own equality operator here + def __eq__(self, other): + return not self.__ne__(other) + def __iter__(self): '''Iterate over all types in a lldb.SBTypeList object.''' return lldb_iter(self, 'GetSize', 'GetTypeAtIndex') |
