1*99451b44SJordan Rupprechtimport lldb 2*99451b44SJordan Rupprechtfrom lldbsuite.test.decorators import * 3*99451b44SJordan Rupprechtfrom lldbsuite.test.lldbtest import * 4*99451b44SJordan Rupprechtfrom lldbsuite.test import lldbutil 5*99451b44SJordan Rupprecht 6*99451b44SJordan Rupprechtclass TestCase(TestBase): 7*99451b44SJordan Rupprecht 8*99451b44SJordan Rupprecht mydir = TestBase.compute_mydir(__file__) 9*99451b44SJordan Rupprecht 10*99451b44SJordan Rupprecht def test(self): 11*99451b44SJordan Rupprecht self.build() 12*99451b44SJordan Rupprecht lldbutil.run_to_source_breakpoint(self,"// break here", lldb.SBFileSpec("main.cpp")) 13*99451b44SJordan Rupprecht 14*99451b44SJordan Rupprecht # Test calling a function that has const/non-const overload. 15*99451b44SJordan Rupprecht self.expect_expr("c.func()", result_type="int", result_value="111") 16*99451b44SJordan Rupprecht self.expect_expr("const_c.func()", result_type="int", result_value="222") 17*99451b44SJordan Rupprecht 18*99451b44SJordan Rupprecht # Call a function that is only const on a const/non-const instance. 19*99451b44SJordan Rupprecht self.expect_expr("c.const_func()", result_type="int", result_value="333") 20*99451b44SJordan Rupprecht self.expect_expr("const_c.const_func()", result_type="int", result_value="333") 21*99451b44SJordan Rupprecht 22*99451b44SJordan Rupprecht # Call a function that is not const on a const/non-const instance. 23*99451b44SJordan Rupprecht self.expect_expr("c.nonconst_func()", result_type="int", result_value="444") 24*99451b44SJordan Rupprecht self.expect("expr const_c.nonconst_func()", error=True, 25*99451b44SJordan Rupprecht substrs=["'this' argument to member function 'nonconst_func' has type 'const C', but function is not marked const"]) 26