1*7862728cSRaphael Isemannimport lldb
2*7862728cSRaphael Isemannfrom lldbsuite.test.decorators import *
3*7862728cSRaphael Isemannfrom lldbsuite.test.lldbtest import *
4*7862728cSRaphael Isemannfrom lldbsuite.test import lldbutil
599451b44SJordan Rupprecht
6*7862728cSRaphael Isemann
7*7862728cSRaphael Isemannclass TestCase(TestBase):
8*7862728cSRaphael Isemann    NO_DEBUG_INFO_TESTCASE = True
9*7862728cSRaphael Isemann
10*7862728cSRaphael Isemann    def run_class_tests(self):
11*7862728cSRaphael Isemann        # Expression not referencing context class.
12*7862728cSRaphael Isemann        self.expect_expr("1 + 1", result_type="int", result_value="2")
13*7862728cSRaphael Isemann        # Referencing context class.
14*7862728cSRaphael Isemann        # FIXME: This and the expression below should return const types.
15*7862728cSRaphael Isemann        self.expect_expr("member", result_type="int", result_value="3")
16*7862728cSRaphael Isemann        # Check the type of context class.
17*7862728cSRaphael Isemann        self.expect_expr("this", result_type="ContextClass *")
18*7862728cSRaphael Isemann
19*7862728cSRaphael Isemann    def test_member_func(self):
20*7862728cSRaphael Isemann        self.build()
21*7862728cSRaphael Isemann        lldbutil.run_to_source_breakpoint(
22*7862728cSRaphael Isemann            self, "// break in function in class.", lldb.SBFileSpec("main.cpp")
23*7862728cSRaphael Isemann        )
24*7862728cSRaphael Isemann        self.run_class_tests()
25*7862728cSRaphael Isemann
26*7862728cSRaphael Isemann    def test_templated_member_func(self):
27*7862728cSRaphael Isemann        self.build()
28*7862728cSRaphael Isemann        lldbutil.run_to_source_breakpoint(
29*7862728cSRaphael Isemann            self,
30*7862728cSRaphael Isemann            "// break in templated function in class.",
31*7862728cSRaphael Isemann            lldb.SBFileSpec("main.cpp"),
32*7862728cSRaphael Isemann        )
33*7862728cSRaphael Isemann        self.run_class_tests()
34*7862728cSRaphael Isemann
35*7862728cSRaphael Isemann    def run_template_class_tests(self):
36*7862728cSRaphael Isemann        # Expression not referencing context class.
37*7862728cSRaphael Isemann        self.expect_expr("1 + 1", result_type="int", result_value="2")
38*7862728cSRaphael Isemann        # Referencing context class.
39*7862728cSRaphael Isemann        # FIXME: This and the expression below should return const types.
40*7862728cSRaphael Isemann        self.expect_expr("member", result_type="int", result_value="4")
41*7862728cSRaphael Isemann        # Check the type of context class.
42*7862728cSRaphael Isemann        self.expect_expr("this", result_type="TemplatedContextClass<int> *")
43*7862728cSRaphael Isemann
44*7862728cSRaphael Isemann    def test_template_member_func(self):
45*7862728cSRaphael Isemann        self.build()
46*7862728cSRaphael Isemann        lldbutil.run_to_source_breakpoint(
47*7862728cSRaphael Isemann            self,
48*7862728cSRaphael Isemann            "// break in function in templated class.",
49*7862728cSRaphael Isemann            lldb.SBFileSpec("main.cpp"),
50*7862728cSRaphael Isemann        )
51*7862728cSRaphael Isemann        self.run_template_class_tests()
52*7862728cSRaphael Isemann
53*7862728cSRaphael Isemann    def test_template_templated_member_func(self):
54*7862728cSRaphael Isemann        self.build()
55*7862728cSRaphael Isemann        lldbutil.run_to_source_breakpoint(
56*7862728cSRaphael Isemann            self,
57*7862728cSRaphael Isemann            "// break in templated function in templated class.",
58*7862728cSRaphael Isemann            lldb.SBFileSpec("main.cpp"),
59*7862728cSRaphael Isemann        )
60*7862728cSRaphael Isemann        self.run_template_class_tests()
61