| import lldb |
| from lldbsuite.test.decorators import * |
| from lldbsuite.test.lldbtest import * |
| from lldbsuite.test import lldbutil |
| |
| |
| class TestCase(TestBase): |
| def test(self): |
| self.build() |
| (_, process, _, _) = lldbutil.run_to_source_breakpoint( |
| self, "Break here: const", lldb.SBFileSpec("main.cpp") |
| ) |
| |
| self.expect_expr("bar()", result_type="double", result_value="5") |
| self.expect_expr("const_volatile_method()") |
| self.expect_expr("const_method()") |
| self.expect( |
| "expression volatile_method()", |
| error=True, |
| substrs=["has type 'const Foo'", "but function is not marked const"], |
| ) |
| |
| lldbutil.continue_to_source_breakpoint( |
| self, process, "Break here: volatile", lldb.SBFileSpec("main.cpp") |
| ) |
| |
| self.expect_expr( |
| "bar()", result_type="const char *", result_summary='"volatile_bar"' |
| ) |
| self.expect_expr("const_volatile_method()") |
| self.expect( |
| "expression const_method()", |
| error=True, |
| substrs=["has type 'volatile Foo'", "but function is not marked volatile"], |
| ) |
| self.expect_expr("volatile_method()") |
| |
| lldbutil.continue_to_source_breakpoint( |
| self, process, "Break here: const volatile", lldb.SBFileSpec("main.cpp") |
| ) |
| |
| self.expect_expr("bar()", result_type="int", result_value="2") |
| self.expect_expr("other_cv_method()") |
| |
| self.expect( |
| "expression const_method()", |
| error=True, |
| substrs=[ |
| "has type 'const volatile Foo'", |
| "but function is not marked const or volatile", |
| ], |
| ) |
| self.expect( |
| "expression volatile_method()", |
| error=True, |
| substrs=[ |
| "has type 'const volatile Foo'", |
| "but function is not marked const or volatile", |
| ], |
| ) |