[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

Vlad Serebrennikov via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 13 02:52:42 PDT 2023


================
@@ -119,6 +119,38 @@ def test(self):
 
         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)
----------------
Endilll wrote:

At the moment we don't have an API to get (direct) `DeclContext` of a type, as far as I know. So I made enums distinct by using underlying type of different size.

https://github.com/llvm/llvm-project/pull/68705


More information about the lldb-commits mailing list