summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/API/SBType.h3
-rw-r--r--lldb/scripts/Python/interface/SBType.i3
-rw-r--r--lldb/source/API/SBType.cpp6
-rw-r--r--lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py6
4 files changed, 14 insertions, 4 deletions
diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 14bd35cf05c..5ef83130016 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -101,6 +101,9 @@ public:
SBTypeList&
operator = (const SBTypeList& rhs);
+ bool
+ IsValid() const;
+
void
Append (const SBType& type);
diff --git a/lldb/scripts/Python/interface/SBType.i b/lldb/scripts/Python/interface/SBType.i
index 48f20f1f2d6..3086338d800 100644
--- a/lldb/scripts/Python/interface/SBType.i
+++ b/lldb/scripts/Python/interface/SBType.i
@@ -156,6 +156,9 @@ class SBTypeList
public:
SBTypeList();
+ bool
+ IsValid() const;
+
void
Append(const SBType& type);
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index 64c64acb97d..582eceec1e3 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -323,6 +323,12 @@ SBTypeList::SBTypeList(const SBTypeList& rhs) :
Append(rhs.GetTypeAtIndex(i));
}
+bool
+SBTypeList::IsValid () const
+{
+ return (m_opaque_ap.get() != NULL);
+}
+
SBTypeList&
SBTypeList::operator = (const SBTypeList& rhs)
{
diff --git a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
index 69a45506110..c41fc16cbf2 100644
--- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
+++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
@@ -313,13 +313,11 @@ class APIDefaultConstructorTestCase(TestBase):
@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):
OpenPOWER on IntegriCloud