xref: /llvm-project/lldb/test/API/lang/cpp/preferred_name/TestPreferredName.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
19ca707b6SMichael Buch"""
29ca707b6SMichael BuchTest formatting of types annotated with
39ca707b6SMichael Buch[[clang::preferred_name]] attributes.
49ca707b6SMichael Buch"""
59ca707b6SMichael Buch
69ca707b6SMichael Buchimport lldb
79ca707b6SMichael Buchimport lldbsuite.test.lldbutil as lldbutil
89ca707b6SMichael Buchfrom lldbsuite.test.lldbtest import *
9b4cae6bfSMichael Buchfrom lldbsuite.test.decorators import *
109ca707b6SMichael Buch
119ca707b6SMichael Buch
12*2238dcc3SJonas Devlieghereclass TestPreferredName(TestBase):
13*2238dcc3SJonas Devlieghere    @skipIf(compiler="clang", compiler_version=["<", "16.0"])
149ca707b6SMichael Buch    def test_frame_var(self):
159ca707b6SMichael Buch        self.build()
169ca707b6SMichael Buch        lldbutil.run_to_source_breakpoint(self, "return", lldb.SBFileSpec("main.cpp"))
179ca707b6SMichael Buch
189ca707b6SMichael Buch        self.expect("frame variable barInt", substrs=["BarInt"])
199ca707b6SMichael Buch        self.expect("frame variable barDouble", substrs=["BarDouble"])
209ca707b6SMichael Buch        self.expect("frame variable barShort", substrs=["Bar<short>"])
219ca707b6SMichael Buch        self.expect("frame variable barChar", substrs=["Bar<char>"])
229ca707b6SMichael Buch
239ca707b6SMichael Buch        self.expect("frame variable varInt", substrs=["BarInt"])
249ca707b6SMichael Buch        self.expect("frame variable varDouble", substrs=["BarDouble"])
259ca707b6SMichael Buch        self.expect("frame variable varShort", substrs=["Bar<short>"])
269ca707b6SMichael Buch        self.expect("frame variable varChar", substrs=["Bar<char>"])
279ca707b6SMichael Buch        self.expect("frame variable varFooInt", substrs=["Foo<BarInt>"])
289ca707b6SMichael Buch
29*2238dcc3SJonas Devlieghere    @skipIf(compiler="clang", compiler_version=["<", "16.0"])
309ca707b6SMichael Buch    def test_expr(self):
319ca707b6SMichael Buch        self.build()
329ca707b6SMichael Buch        lldbutil.run_to_source_breakpoint(self, "return", lldb.SBFileSpec("main.cpp"))
339ca707b6SMichael Buch
349ca707b6SMichael Buch        self.expect_expr("barInt", result_type="BarInt")
359ca707b6SMichael Buch        self.expect_expr("barDouble", result_type="BarDouble")
369ca707b6SMichael Buch        self.expect_expr("barShort", result_type="Bar<short>")
379ca707b6SMichael Buch        self.expect_expr("barChar", result_type="Bar<char>")
389ca707b6SMichael Buch
399ca707b6SMichael Buch        self.expect_expr("varInt", result_type="BarInt")
409ca707b6SMichael Buch        self.expect_expr("varDouble", result_type="BarDouble")
419ca707b6SMichael Buch        self.expect_expr("varShort", result_type="Bar<short>")
429ca707b6SMichael Buch        self.expect_expr("varChar", result_type="Bar<char>")
439ca707b6SMichael Buch        self.expect_expr("varFooInt", result_type="Foo<BarInt>")
44