[Lldb-commits] [lldb] r136990 - in /lldb/trunk: include/lldb/API/SBType.h scripts/Python/interface/SBType.i source/API/SBType.cpp test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py

Johnny Chen johnny.chen at apple.com
Fri Aug 5 15:23:26 PDT 2011


Author: johnny
Date: Fri Aug  5 17:23:26 2011
New Revision: 136990

URL: http://llvm.org/viewvc/llvm-project?rev=136990&view=rev
Log:
On second thought, add the IsValid() method to SBTypeList, making it similar to SBSymbolContextList and SBValueList.
Modify the test suite accordingly.

Modified:
    lldb/trunk/include/lldb/API/SBType.h
    lldb/trunk/scripts/Python/interface/SBType.i
    lldb/trunk/source/API/SBType.cpp
    lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py

Modified: lldb/trunk/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBType.h?rev=136990&r1=136989&r2=136990&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBType.h (original)
+++ lldb/trunk/include/lldb/API/SBType.h Fri Aug  5 17:23:26 2011
@@ -101,6 +101,9 @@
     SBTypeList&
     operator = (const SBTypeList& rhs);
     
+    bool
+    IsValid() const;
+
     void
     Append (const SBType& type);
     

Modified: lldb/trunk/scripts/Python/interface/SBType.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBType.i?rev=136990&r1=136989&r2=136990&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBType.i (original)
+++ lldb/trunk/scripts/Python/interface/SBType.i Fri Aug  5 17:23:26 2011
@@ -156,6 +156,9 @@
 public:
     SBTypeList();
 
+    bool
+    IsValid() const;
+
     void
     Append(const SBType& type);
 

Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=136990&r1=136989&r2=136990&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Fri Aug  5 17:23:26 2011
@@ -323,6 +323,12 @@
         Append(rhs.GetTypeAtIndex(i));
 }
 
+bool
+SBTypeList::IsValid () const
+{
+    return (m_opaque_ap.get() != NULL);
+}
+
 SBTypeList&
 SBTypeList::operator = (const SBTypeList& rhs)
 {

Modified: lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py?rev=136990&r1=136989&r2=136990&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Fri Aug  5 17:23:26 2011
@@ -313,13 +313,11 @@
 
     @python_api_test
     def test_SBTypeList(self):
+        """SBTypeList object is valid after default construction."""
         obj = lldb.SBTypeList()
         if self.TraceOn():
             print obj
-        # SBTypeList does not have IsValid() method defined.  It's always valid
-        # in a sense.  So the Python's truth value testing in turn delegates to
-        # __len__() method, which is defined for SBTypeList, and returns 0.
-        self.assertFalse(obj)
+        self.assertTrue(obj)
 
     @python_api_test
     def test_SBValue(self):





More information about the lldb-commits mailing list