brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 39b720b Raw
43 lines · python
1"""2Test std::unique_ptr functionality with a decl from debug info as content.3"""4 5from lldbsuite.test.decorators import *6from lldbsuite.test.lldbtest import *7from lldbsuite.test import lldbutil8 9 10class TestUniquePtrDbgInfoContent(TestBase):11    @add_test_categories(["libc++"])12    @skipIf(compiler=no_match("clang"))13    @skipIf(compiler="clang", compiler_version=["<", "9.0"])14    @skipIf(macos_version=["<", "15.0"])15    @skipIfLinux  # s.reset() causes link errors on ubuntu 18.04/Clang 916    def test(self):17        self.build()18 19        lldbutil.run_to_source_breakpoint(20            self, "// Set break point at this line.", lldb.SBFileSpec("main.cpp")21        )22 23        self.runCmd("settings set target.import-std-module true")24 25        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(26            [">", "16.0"]27        ):28            ptr_type = "std::unique_ptr<Foo>"29        else:30            ptr_type = "std::unique_ptr<Foo, std::default_delete<Foo> >"31 32        self.expect_expr(33            "s",34            result_type=ptr_type,35            result_children=[ValueCheck(children=[ValueCheck(value="3")])],36        )37        self.expect_expr("s->a", result_type="int", result_value="3")38        self.expect_expr("s->a = 5", result_type="int", result_value="5")39        self.expect_expr("(int)s->a", result_type="int", result_value="5")40        self.expect_expr("(bool)s", result_type="bool", result_value="true")41        self.expect("expr s.reset()")42        self.expect_expr("(bool)s", result_type="bool", result_value="false")43