[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.
This commit is contained in:
Jonas Devlieghere 2021-01-06 17:10:20 -08:00
parent b9bfe8a753
commit fbc13e9345
1 changed files with 21 additions and 20 deletions

View File

@ -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())
# 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')
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')
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')