From fbc13e9345c7c9607f0c28e0ccfa9a7baf254f29 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 6 Jan 2021 17:10:20 -0800 Subject: [PATCH] [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. --- lldb/test/API/python_api/type/TestTypeList.py | 45 ++++++++++++++------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/lldb/test/API/python_api/type/TestTypeList.py b/lldb/test/API/python_api/type/TestTypeList.py index ff560de2f96..359dfe8cf5a 100644 --- a/lldb/test/API/python_api/type/TestTypeList.py +++ b/lldb/test/API/python_api/type/TestTypeList.py @@ -145,25 +145,26 @@ class TypeAndTypeListTestCase(TestBase): 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') -- 2.11.0