1""" 2Test formatting of types annotated with 3[[clang::preferred_name]] attributes. 4""" 5 6import lldb 7import lldbsuite.test.lldbutil as lldbutil 8from lldbsuite.test.lldbtest import * 9from lldbsuite.test.decorators import * 10 11 12class TestPreferredName(TestBase): 13 @skipIf(compiler="clang", compiler_version=["<", "16.0"]) 14 def test_frame_var(self): 15 self.build() 16 lldbutil.run_to_source_breakpoint(self, "return", lldb.SBFileSpec("main.cpp")) 17 18 self.expect("frame variable barInt", substrs=["BarInt"]) 19 self.expect("frame variable barDouble", substrs=["BarDouble"]) 20 self.expect("frame variable barShort", substrs=["Bar<short>"]) 21 self.expect("frame variable barChar", substrs=["Bar<char>"]) 22 23 self.expect("frame variable varInt", substrs=["BarInt"]) 24 self.expect("frame variable varDouble", substrs=["BarDouble"]) 25 self.expect("frame variable varShort", substrs=["Bar<short>"]) 26 self.expect("frame variable varChar", substrs=["Bar<char>"]) 27 self.expect("frame variable varFooInt", substrs=["Foo<BarInt>"]) 28 29 @skipIf(compiler="clang", compiler_version=["<", "16.0"]) 30 def test_expr(self): 31 self.build() 32 lldbutil.run_to_source_breakpoint(self, "return", lldb.SBFileSpec("main.cpp")) 33 34 self.expect_expr("barInt", result_type="BarInt") 35 self.expect_expr("barDouble", result_type="BarDouble") 36 self.expect_expr("barShort", result_type="Bar<short>") 37 self.expect_expr("barChar", result_type="Bar<char>") 38 39 self.expect_expr("varInt", result_type="BarInt") 40 self.expect_expr("varDouble", result_type="BarDouble") 41 self.expect_expr("varShort", result_type="Bar<short>") 42 self.expect_expr("varChar", result_type="Bar<char>") 43 self.expect_expr("varFooInt", result_type="Foo<BarInt>") 44