[lldb] Add SBType::IsScopedEnumerationType method

Add a method to check if the type is a scoped enumeration (i.e. "enum
class/struct").

Differential revision: https://reviews.llvm.org/D93690
This commit is contained in:
Andy Yankovsky
2020-12-22 10:06:46 -08:00
committed by Jonas Devlieghere
parent f5071489ea
commit e17a00fc87
10 changed files with 55 additions and 0 deletions

View File

@@ -144,3 +144,13 @@ class TypeAndTypeListTestCase(TestBase):
myint_type = target.FindFirstType('myint')
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())

View File

@@ -29,6 +29,8 @@ public:
{}
};
enum EnumType {};
enum class ScopedEnumType {};
int main (int argc, char const *argv[])
{
@@ -59,5 +61,8 @@ int main (int argc, char const *argv[])
typedef int myint;
myint myint_arr[] = {1, 2, 3};
EnumType enum_type;
ScopedEnumType scoped_enum_type;
return 0; // Break at this line
}