On second thought, add the IsValid() method to SBTypeList, making it similar to SBSymbolContextList and SBValueList.
Modify the test suite accordingly. llvm-svn: 136990
This commit is contained in:
parent
8627ea91cb
commit
76ea84eaf4
|
@ -101,6 +101,9 @@ public:
|
|||
SBTypeList&
|
||||
operator = (const SBTypeList& rhs);
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
void
|
||||
Append (const SBType& type);
|
||||
|
||||
|
|
|
@ -156,6 +156,9 @@ class SBTypeList
|
|||
public:
|
||||
SBTypeList();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
void
|
||||
Append(const SBType& type);
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue