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