|
| 1 | +""" |
| 2 | +Test LLDB type promotion of unscoped enums. |
| 3 | +""" |
| 4 | + |
| 5 | +import lldb |
| 6 | +from lldbsuite.test.decorators import * |
| 7 | +from lldbsuite.test.lldbtest import * |
| 8 | +from lldbsuite.test import lldbutil |
| 9 | + |
| 10 | +class TestCPPEnumPromotion(TestBase): |
| 11 | + |
| 12 | + @skipIf(debug_info=no_match(["dwarf", "dwo"])) |
| 13 | + def test(self): |
| 14 | + self.build() |
| 15 | + lldbutil.run_to_source_breakpoint( |
| 16 | + self, "// break here", lldb.SBFileSpec("main.cpp") |
| 17 | + ) |
| 18 | + UChar_promoted = self.frame().FindVariable("UChar_promoted") |
| 19 | + UShort_promoted = self.frame().FindVariable("UShort_promoted") |
| 20 | + UInt_promoted = self.frame().FindVariable("UInt_promoted") |
| 21 | + SLong_promoted = self.frame().FindVariable("SLong_promoted") |
| 22 | + ULong_promoted = self.frame().FindVariable("ULong_promoted") |
| 23 | + NChar_promoted = self.frame().FindVariable("NChar_promoted") |
| 24 | + NShort_promoted = self.frame().FindVariable("NShort_promoted") |
| 25 | + NInt_promoted = self.frame().FindVariable("NInt_promoted") |
| 26 | + NLong_promoted = self.frame().FindVariable("NLong_promoted") |
| 27 | + |
| 28 | + # Check that LLDB's promoted type is the same as the compiler's |
| 29 | + self.expect_expr("+EnumUChar::UChar", result_type=UChar_promoted.type.name) |
| 30 | + self.expect_expr("+EnumUShort::UShort", result_type=UShort_promoted.type.name) |
| 31 | + self.expect_expr("+EnumUInt::UInt", result_type=UInt_promoted.type.name) |
| 32 | + self.expect_expr("+EnumSLong::SLong", result_type=SLong_promoted.type.name) |
| 33 | + self.expect_expr("+EnumULong::ULong", result_type=ULong_promoted.type.name) |
| 34 | + self.expect_expr("+EnumNChar::NChar", result_type=NChar_promoted.type.name) |
| 35 | + self.expect_expr("+EnumNShort::NShort", result_type=NShort_promoted.type.name) |
| 36 | + self.expect_expr("+EnumNInt::NInt", result_type=NInt_promoted.type.name) |
| 37 | + self.expect_expr("+EnumNLong::NLong", result_type=NLong_promoted.type.name) |
0 commit comments