diff options
Diffstat (limited to 'lldb/test/API/python_api')
| -rw-r--r-- | lldb/test/API/python_api/type/TestTypeList.py | 31 | ||||
| -rw-r--r-- | lldb/test/API/python_api/type/main.cpp | 5 |
2 files changed, 36 insertions, 0 deletions
diff --git a/lldb/test/API/python_api/type/TestTypeList.py b/lldb/test/API/python_api/type/TestTypeList.py index c2fcadc..c267def 100644 --- a/lldb/test/API/python_api/type/TestTypeList.py +++ b/lldb/test/API/python_api/type/TestTypeList.py @@ -119,6 +119,37 @@ class TypeAndTypeListTestCase(TestBase): self.assertEqual(task_type, task_head_pointee_type) + # Check whether we can find a directly nested type by name + name_type = task_type.FindDirectNestedType("name") + self.assertTrue(name_type) + self.DebugSBType(name_type) + + enum_type = task_type.FindDirectNestedType("E") + self.assertTrue(enum_type) + self.DebugSBType(enum_type) + + union_type = task_type.FindDirectNestedType("U") + self.assertTrue(union_type) + self.DebugSBType(union_type) + + # Check that we don't find indirectly nested types + self.assertTrue(enum_type.size == 1) + + invalid_type = task_type.FindDirectNestedType("E2") + self.assertFalse(invalid_type) + + # Check that FindDirectNestedType handles types without DeclContext + # and other errorneous inputs + task_ptr_type = task_type.GetPointerType() + invalid_type = task_ptr_type.FindDirectNestedType("name") + self.assertFalse(invalid_type) + + invalid_type = task_type.FindDirectNestedType("") + self.assertFalse(invalid_type) + + invalid_type = task_type.FindDirectNestedType(None) + self.assertFalse(invalid_type) + # We'll now get the child member 'id' from 'task_head'. id = task_head.GetChildMemberWithName("id") self.DebugSBValue(id) diff --git a/lldb/test/API/python_api/type/main.cpp b/lldb/test/API/python_api/type/main.cpp index b1ef625..98de970 100644 --- a/lldb/test/API/python_api/type/main.cpp +++ b/lldb/test/API/python_api/type/main.cpp @@ -21,7 +21,12 @@ public: } my_type_is_nameless; struct name { int x; + enum E : int {} e; + enum E2 {} e2; } my_type_is_named; + enum E : unsigned char {} e; + union U { + } u; Task(int i, Task *n): id(i), next(n), |
