[Lldb-commits] [lldb] r180987 - <rdar://problem/11742979>

Enrico Granata egranata at apple.com
Thu May 2 18:29:27 PDT 2013


Author: enrico
Date: Thu May  2 20:29:27 2013
New Revision: 180987

URL: http://llvm.org/viewvc/llvm-project?rev=180987&view=rev
Log:
<rdar://problem/11742979>

SWIG is smart enough to recognize that C++ operators == and != mean __eq__ and __ne__ in Python and do the appropriate translation
But it is not smart enough to recognize that mySBObject == None should return False instead of erroring out
The %pythoncode blocks are meant to provide those extra smarts (and they play some SWIG&Python magic to find the right function to call behind the scenes with no risk of typos :-)
Lastly, SBBreakpoint provides an == but never provided a != operator - common courtesy is to provide both

Modified:
    lldb/trunk/include/lldb/API/SBBreakpoint.h
    lldb/trunk/scripts/Python/interface/SBBreakpoint.i
    lldb/trunk/scripts/Python/interface/SBBroadcaster.i
    lldb/trunk/scripts/Python/interface/SBCompileUnit.i
    lldb/trunk/scripts/Python/interface/SBDeclaration.i
    lldb/trunk/scripts/Python/interface/SBFunction.i
    lldb/trunk/scripts/Python/interface/SBLineEntry.i
    lldb/trunk/scripts/Python/interface/SBModule.i
    lldb/trunk/scripts/Python/interface/SBSection.i
    lldb/trunk/scripts/Python/interface/SBSymbol.i
    lldb/trunk/scripts/Python/interface/SBTarget.i
    lldb/trunk/scripts/Python/interface/SBThread.i
    lldb/trunk/scripts/Python/interface/SBTypeFilter.i
    lldb/trunk/scripts/Python/interface/SBTypeFormat.i
    lldb/trunk/scripts/Python/interface/SBTypeNameSpecifier.i
    lldb/trunk/scripts/Python/interface/SBTypeSummary.i
    lldb/trunk/scripts/Python/interface/SBTypeSynthetic.i
    lldb/trunk/scripts/Python/python-extensions.swig
    lldb/trunk/source/API/SBBreakpoint.cpp

Modified: lldb/trunk/include/lldb/API/SBBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpoint.h?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBreakpoint.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpoint.h Thu May  2 20:29:27 2013
@@ -37,6 +37,9 @@ public:
     bool
     operator == (const lldb::SBBreakpoint& rhs);
 
+    bool
+    operator != (const lldb::SBBreakpoint& rhs);
+    
     break_id_t
     GetID () const;
 

Modified: lldb/trunk/scripts/Python/interface/SBBreakpoint.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBBreakpoint.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBBreakpoint.i (original)
+++ lldb/trunk/scripts/Python/interface/SBBreakpoint.i Thu May  2 20:29:27 2013
@@ -189,6 +189,12 @@ public:
     bool
     GetDescription (lldb::SBStream &description);
 
+    bool
+    operator == (const lldb::SBBreakpoint& rhs);
+           
+    bool
+    operator != (const lldb::SBBreakpoint& rhs);
+
     static bool
     EventIsBreakpointEvent (const lldb::SBEvent &event);
     

Modified: lldb/trunk/scripts/Python/interface/SBBroadcaster.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBBroadcaster.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBBroadcaster.i (original)
+++ lldb/trunk/scripts/Python/interface/SBBroadcaster.i Thu May  2 20:29:27 2013
@@ -57,6 +57,12 @@ public:
 
     bool
     RemoveListener (const lldb::SBListener &listener, uint32_t event_mask = UINT32_MAX);
+    
+    bool
+    operator == (const lldb::SBBroadcaster &rhs) const;
+    
+    bool
+    operator != (const lldb::SBBroadcaster &rhs) const;
 };
 
 } // namespace lldb

Modified: lldb/trunk/scripts/Python/interface/SBCompileUnit.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBCompileUnit.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBCompileUnit.i (original)
+++ lldb/trunk/scripts/Python/interface/SBCompileUnit.i Thu May  2 20:29:27 2013
@@ -89,6 +89,12 @@ public:
     bool
     GetDescription (lldb::SBStream &description);
     
+    bool
+    operator == (const lldb::SBCompileUnit &rhs) const;
+    
+    bool
+    operator != (const lldb::SBCompileUnit &rhs) const;
+    
     %pythoncode %{
         __swig_getmethods__["file"] = GetFileSpec
         if _newclass: file = property(GetFileSpec, None, doc='''A read only property that returns the same result an lldb object that represents the source file (lldb.SBFileSpec) for the compile unit.''')

Modified: lldb/trunk/scripts/Python/interface/SBDeclaration.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBDeclaration.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBDeclaration.i (original)
+++ lldb/trunk/scripts/Python/interface/SBDeclaration.i Thu May  2 20:29:27 2013
@@ -46,6 +46,12 @@ namespace lldb {
         void
         SetColumn (uint32_t column);
         
+        bool
+        operator == (const lldb::SBDeclaration &rhs) const;
+        
+        bool
+        operator != (const lldb::SBDeclaration &rhs) const;
+        
         %pythoncode %{
             __swig_getmethods__["file"] = GetFileSpec
             if _newclass: file = property(GetFileSpec, None, doc='''A read only property that returns an lldb object that represents the file (lldb.SBFileSpec) for this line entry.''')

Modified: lldb/trunk/scripts/Python/interface/SBFunction.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBFunction.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBFunction.i (original)
+++ lldb/trunk/scripts/Python/interface/SBFunction.i Thu May  2 20:29:27 2013
@@ -86,6 +86,12 @@ public:
     bool
     GetDescription (lldb::SBStream &description);
     
+    bool
+    operator == (const lldb::SBFunction &rhs) const;
+    
+    bool
+    operator != (const lldb::SBFunction &rhs) const;
+    
     %pythoncode %{
         def get_instructions_from_current_target (self):
             return self.GetInstructions (target)

Modified: lldb/trunk/scripts/Python/interface/SBLineEntry.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBLineEntry.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBLineEntry.i (original)
+++ lldb/trunk/scripts/Python/interface/SBLineEntry.i Thu May  2 20:29:27 2013
@@ -77,6 +77,12 @@ public:
     void
     SetColumn (uint32_t column);
 
+    bool
+    operator == (const lldb::SBLineEntry &rhs) const;
+    
+    bool
+    operator != (const lldb::SBLineEntry &rhs) const;
+    
     %pythoncode %{
         __swig_getmethods__["file"] = GetFileSpec
         if _newclass: file = property(GetFileSpec, None, doc='''A read only property that returns an lldb object that represents the file (lldb.SBFileSpec) for this line entry.''')

Modified: lldb/trunk/scripts/Python/interface/SBModule.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBModule.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBModule.i (original)
+++ lldb/trunk/scripts/Python/interface/SBModule.i Thu May  2 20:29:27 2013
@@ -279,6 +279,12 @@ public:
     GetVersion (uint32_t *versions, 
                 uint32_t num_versions);
 
+    bool
+    operator == (const lldb::SBModule &rhs) const;
+             
+    bool
+    operator != (const lldb::SBModule &rhs) const;
+             
     %pythoncode %{
         class symbols_access(object):
             re_compile_type = type(re.compile('.'))

Modified: lldb/trunk/scripts/Python/interface/SBSection.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBSection.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBSection.i (original)
+++ lldb/trunk/scripts/Python/interface/SBSection.i Thu May  2 20:29:27 2013
@@ -90,6 +90,12 @@ public:
     bool
     GetDescription (lldb::SBStream &description);
     
+    bool
+    operator == (const lldb::SBSection &rhs);
+
+    bool
+    operator != (const lldb::SBSection &rhs);
+     
     %pythoncode %{
         def get_addr(self):
             return SBAddress(self, 0)

Modified: lldb/trunk/scripts/Python/interface/SBSymbol.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBSymbol.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBSymbol.i (original)
+++ lldb/trunk/scripts/Python/interface/SBSymbol.i Thu May  2 20:29:27 2013
@@ -62,6 +62,12 @@ public:
     bool
     IsSynthetic();
 
+    bool
+    operator == (const lldb::SBSymbol &rhs) const;
+    
+    bool
+    operator != (const lldb::SBSymbol &rhs) const;
+    
     %pythoncode %{
         def get_instructions_from_current_target (self):
             return self.GetInstructions (target)

Modified: lldb/trunk/scripts/Python/interface/SBTarget.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTarget.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTarget.i Thu May  2 20:29:27 2013
@@ -742,6 +742,12 @@ public:
     lldb::addr_t
     GetStackRedZoneSize();
 
+    bool
+    operator == (const lldb::SBTarget &rhs) const;
+
+    bool
+    operator != (const lldb::SBTarget &rhs) const;
+
     lldb::SBValue
     EvaluateExpression (const char *expr, const lldb::SBExpressionOptions &options);
     %pythoncode %{

Modified: lldb/trunk/scripts/Python/interface/SBThread.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBThread.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBThread.i (original)
+++ lldb/trunk/scripts/Python/interface/SBThread.i Thu May  2 20:29:27 2013
@@ -202,6 +202,12 @@ public:
     bool
     GetStatus (lldb::SBStream &status) const;
     
+    bool
+    operator == (const lldb::SBThread &rhs) const;
+
+    bool
+    operator != (const lldb::SBThread &rhs) const;
+             
     %pythoncode %{
         class frames_access(object):
             '''A helper object that will lazily hand out frames for a thread when supplied an index.'''

Modified: lldb/trunk/scripts/Python/interface/SBTypeFilter.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTypeFilter.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTypeFilter.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTypeFilter.i Thu May  2 20:29:27 2013
@@ -55,6 +55,12 @@ namespace lldb {
         bool
         GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
         
+        bool
+        operator == (lldb::SBTypeFilter &rhs);
+        
+        bool
+        operator != (lldb::SBTypeFilter &rhs);
+        
         %pythoncode %{
             __swig_getmethods__["options"] = GetOptions
             __swig_setmethods__["options"] = SetOptions

Modified: lldb/trunk/scripts/Python/interface/SBTypeFormat.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTypeFormat.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTypeFormat.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTypeFormat.i Thu May  2 20:29:27 2013
@@ -46,7 +46,13 @@ namespace lldb {
         bool
         GetDescription (lldb::SBStream &description, 
                         lldb::DescriptionLevel description_level);
-                
+        
+        bool
+        operator == (lldb::SBTypeFormat &rhs);
+
+        bool
+        operator != (lldb::SBTypeFormat &rhs);
+        
         %pythoncode %{
             __swig_getmethods__["format"] = GetFormat
             __swig_setmethods__["format"] = SetFormat

Modified: lldb/trunk/scripts/Python/interface/SBTypeNameSpecifier.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTypeNameSpecifier.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTypeNameSpecifier.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTypeNameSpecifier.i Thu May  2 20:29:27 2013
@@ -46,7 +46,13 @@ namespace lldb {
         bool
         GetDescription (lldb::SBStream &description, 
                         lldb::DescriptionLevel description_level);
-                        
+        
+        bool
+        operator == (lldb::SBTypeNameSpecifier &rhs);
+
+        bool
+        operator != (lldb::SBTypeNameSpecifier &rhs);
+        
         %pythoncode %{
             __swig_getmethods__["name"] = GetName
             if _newclass: name = property(GetName, None)

Modified: lldb/trunk/scripts/Python/interface/SBTypeSummary.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTypeSummary.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTypeSummary.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTypeSummary.i Thu May  2 20:29:27 2013
@@ -69,6 +69,12 @@ namespace lldb {
         GetDescription (lldb::SBStream &description, 
                         lldb::DescriptionLevel description_level);
         
+        bool
+        operator == (lldb::SBTypeSummary &rhs);
+        
+        bool
+        operator != (lldb::SBTypeSummary &rhs);
+        
         %pythoncode %{
             __swig_getmethods__["options"] = GetOptions
             __swig_setmethods__["options"] = SetOptions

Modified: lldb/trunk/scripts/Python/interface/SBTypeSynthetic.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTypeSynthetic.i?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTypeSynthetic.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTypeSynthetic.i Thu May  2 20:29:27 2013
@@ -57,6 +57,12 @@ namespace lldb {
         GetDescription (lldb::SBStream &description, 
                         lldb::DescriptionLevel description_level);
         
+        bool
+        operator == (lldb::SBTypeSynthetic &rhs);
+
+        bool
+        operator != (lldb::SBTypeSynthetic &rhs);
+        
         %pythoncode %{
             __swig_getmethods__["options"] = GetOptions
             __swig_setmethods__["options"] = SetOptions

Modified: lldb/trunk/scripts/Python/python-extensions.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-extensions.swig?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/python-extensions.swig (original)
+++ lldb/trunk/scripts/Python/python-extensions.swig Thu May  2 20:29:27 2013
@@ -40,6 +40,21 @@
                 else
                     return PyString_FromString("");
         }
+        
+    %pythoncode %{ 
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
+
 }
 %extend lldb::SBBreakpointLocation {
         PyObject *lldb::SBBreakpointLocation::__str__ (){
@@ -55,6 +70,23 @@
                     return PyString_FromString("");
         }
 }
+
+%extend lldb::SBBroadcaster {
+    %pythoncode %{ 
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
+}
+
 %extend lldb::SBCommandReturnObject {
         PyObject *lldb::SBCommandReturnObject::__str__ (){
                 lldb::SBStream description;
@@ -95,6 +127,19 @@
                 else
                     return PyString_FromString("");
         }
+    %pythoncode %{ 
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
 }
 %extend lldb::SBData {
         PyObject *lldb::SBData::__str__ (){
@@ -137,6 +182,21 @@
                 else
                     return PyString_FromString("");
         }
+        
+    %pythoncode %{ 
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
+
 }
 %extend lldb::SBError {
         PyObject *lldb::SBError::__str__ (){
@@ -193,6 +253,21 @@
                 else
                     return PyString_FromString("");
         }
+        
+    %pythoncode %{ 
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
+
 }
 %extend lldb::SBInstruction {
         PyObject *lldb::SBInstruction::__str__ (){
@@ -235,6 +310,20 @@
                 else
                     return PyString_FromString("");
         }
+        
+    %pythoncode %{ 
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
 }
 %extend lldb::SBModule {
         PyObject *lldb::SBModule::__str__ (){
@@ -249,6 +338,20 @@
                 else
                     return PyString_FromString("");
         }
+        
+    %pythoncode %{ 
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
 }
 %extend lldb::SBProcess {
         PyObject *lldb::SBProcess::__str__ (){
@@ -277,6 +380,20 @@
                 else
                     return PyString_FromString("");
         }
+        
+    %pythoncode %{ 
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
 }
 %extend lldb::SBStream {
         /* the write() and flush() calls are not part of the SB API proper, and are solely for Python usage
@@ -305,6 +422,19 @@
                 else
                     return PyString_FromString("");
         }
+    %pythoncode %{
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
 }
 %extend lldb::SBSymbolContext {
         PyObject *lldb::SBSymbolContext::__str__ (){
@@ -334,6 +464,7 @@
                     return PyString_FromString("");
         }
 }
+
 %extend lldb::SBTarget {
         PyObject *lldb::SBTarget::__str__ (){
                 lldb::SBStream description;
@@ -347,7 +478,22 @@
                 else
                     return PyString_FromString("");
         }
+
+    %pythoncode %{ 
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
 }
+
 %extend lldb::SBType {
         PyObject *lldb::SBType::__str__ (){
                 lldb::SBStream description;
@@ -389,6 +535,19 @@
                 else
                     return PyString_FromString("");
         }
+    %pythoncode %{ 
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
 }
 %extend lldb::SBTypeFormat {
         PyObject *lldb::SBTypeFormat::__str__ (){
@@ -431,6 +590,19 @@
                 else
                     return PyString_FromString("");
         }
+    %pythoncode %{ 
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
 }
 %extend lldb::SBTypeSummary {
         PyObject *lldb::SBTypeSummary::__str__ (){
@@ -445,6 +617,19 @@
                 else
                     return PyString_FromString("");
         }
+    %pythoncode %{ 
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
 }
 %extend lldb::SBTypeSynthetic {
         PyObject *lldb::SBTypeSynthetic::__str__ (){
@@ -459,6 +644,19 @@
                 else
                     return PyString_FromString("");
         }
+    %pythoncode %{ 
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
 }
 %extend lldb::SBThread {
         PyObject *lldb::SBThread::__str__ (){
@@ -473,6 +671,19 @@
                 else
                     return PyString_FromString("");
         }
+    %pythoncode %{ 
+        def __eq__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return False 
+            
+            return getattr(_lldb,self.__class__.__name__+"___eq__")(self, rhs)
+            
+        def __ne__(self, rhs):
+            if not isinstance(rhs, type(self)): 
+                return True 
+            
+            return getattr(_lldb,self.__class__.__name__+"___ne__")(self, rhs)
+    %}
 }
 %extend lldb::SBValue {
         PyObject *lldb::SBValue::__str__ (){

Modified: lldb/trunk/source/API/SBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=180987&r1=180986&r2=180987&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpoint.cpp (original)
+++ lldb/trunk/source/API/SBBreakpoint.cpp Thu May  2 20:29:27 2013
@@ -100,6 +100,14 @@ SBBreakpoint::operator == (const lldb::S
     return false;
 }
 
+bool
+SBBreakpoint::operator != (const lldb::SBBreakpoint& rhs)
+{
+    if (m_opaque_sp && rhs.m_opaque_sp)
+        return m_opaque_sp.get() != rhs.m_opaque_sp.get();
+    return (m_opaque_sp && !rhs.m_opaque_sp) || (rhs.m_opaque_sp && !m_opaque_sp);
+}
+
 break_id_t
 SBBreakpoint::GetID () const
 {





More information about the lldb-commits mailing list