[llvm-branch-commits] [lldb] fbc13e9 - [lldb] Skip scoped enum checks with Dwarf <4

Jonas Devlieghere via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 6 17:18:35 PST 2021


Author: Jonas Devlieghere
Date: 2021-01-06T17:13:33-08:00
New Revision: fbc13e9345c7c9607f0c28e0ccfa9a7baf254f29

URL: https://github.com/llvm/llvm-project/commit/fbc13e9345c7c9607f0c28e0ccfa9a7baf254f29
DIFF: https://github.com/llvm/llvm-project/commit/fbc13e9345c7c9607f0c28e0ccfa9a7baf254f29.diff

LOG: [lldb] Skip scoped enum checks with Dwarf <4

The scoped enum tests depend on DW_AT_enum_class which was added in
Dwarf 4.

I made part of the test conditional on the Dwarf version instead of
splitting it into a separate test and using the decorator to avoid the
overhead of setting up the test.

Added: 
    

Modified: 
    lldb/test/API/python_api/type/TestTypeList.py

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/python_api/type/TestTypeList.py b/lldb/test/API/python_api/type/TestTypeList.py
index ff560de2f96f..359dfe8cf5a9 100644
--- a/lldb/test/API/python_api/type/TestTypeList.py
+++ b/lldb/test/API/python_api/type/TestTypeList.py
@@ -145,25 +145,26 @@ def test(self):
         self.DebugSBType(myint_type)
         self.assertTrue(myint_arr_element_type == myint_type)
 
-        # Test enum methods.
-        enum_type = target.FindFirstType('EnumType')
-        self.assertTrue(enum_type)
-        self.DebugSBType(enum_type)
-        self.assertFalse(enum_type.IsScopedEnumerationType())
-
-        scoped_enum_type = target.FindFirstType('ScopedEnumType')
-        self.assertTrue(scoped_enum_type)
-        self.DebugSBType(scoped_enum_type)
-        self.assertTrue(scoped_enum_type.IsScopedEnumerationType())
-        int_scoped_enum_type = scoped_enum_type.GetEnumerationIntegerType()
-        self.assertTrue(int_scoped_enum_type)
-        self.DebugSBType(int_scoped_enum_type)
-        self.assertEquals(int_scoped_enum_type.GetName(), 'int')
-
-        enum_uchar = target.FindFirstType('EnumUChar')
-        self.assertTrue(enum_uchar)
-        self.DebugSBType(enum_uchar)
-        int_enum_uchar = enum_uchar.GetEnumerationIntegerType()
-        self.assertTrue(int_enum_uchar)
-        self.DebugSBType(int_enum_uchar)
-        self.assertEquals(int_enum_uchar.GetName(), 'unsigned char')
+        # Test enum methods. Requires DW_AT_enum_class which was added in Dwarf 4.
+        if configuration.dwarf_version >= 4:
+            enum_type = target.FindFirstType('EnumType')
+            self.assertTrue(enum_type)
+            self.DebugSBType(enum_type)
+            self.assertFalse(enum_type.IsScopedEnumerationType())
+
+            scoped_enum_type = target.FindFirstType('ScopedEnumType')
+            self.assertTrue(scoped_enum_type)
+            self.DebugSBType(scoped_enum_type)
+            self.assertTrue(scoped_enum_type.IsScopedEnumerationType())
+            int_scoped_enum_type = scoped_enum_type.GetEnumerationIntegerType()
+            self.assertTrue(int_scoped_enum_type)
+            self.DebugSBType(int_scoped_enum_type)
+            self.assertEquals(int_scoped_enum_type.GetName(), 'int')
+
+            enum_uchar = target.FindFirstType('EnumUChar')
+            self.assertTrue(enum_uchar)
+            self.DebugSBType(enum_uchar)
+            int_enum_uchar = enum_uchar.GetEnumerationIntegerType()
+            self.assertTrue(int_enum_uchar)
+            self.DebugSBType(int_enum_uchar)
+            self.assertEquals(int_enum_uchar.GetName(), 'unsigned char')


        


More information about the llvm-branch-commits mailing list