brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · e8676b2 Raw
78 lines · python
1"""2Test std::deque functionality with a decl from dbg info as content.3"""4 5from lldbsuite.test.decorators import *6from lldbsuite.test.lldbtest import *7from lldbsuite.test import lldbutil8 9 10class TestDbgInfoContentDeque(TestBase):11    @add_test_categories(["libc++"])12    @skipIf(compiler=no_match("clang"))13    @skipIf(compiler="clang", compiler_version=["<", "18.0"])14    @skipIf(macos_version=["<", "15.0"])15    @skipIf(16        bugnumber="ASTImport of lambdas not supported: https://github.com/llvm/llvm-project/issues/149477"17    )18    def test(self):19        self.build()20 21        lldbutil.run_to_source_breakpoint(22            self, "// Set break point at this line.", lldb.SBFileSpec("main.cpp")23        )24 25        self.runCmd("settings set target.import-std-module true")26 27        if self.expectedCompiler(["clang"]) and self.expectedCompilerVersion(28            [">", "16.0"]29        ):30            deque_type = "std::deque<Foo>"31        else:32            deque_type = "std::deque<Foo, std::allocator<Foo> >"33 34        size_type = "size_type"35        value_type = "value_type"36 37        iterator_type = "iterator"38        iterator_children = [ValueCheck(name="__m_iter_"), ValueCheck(name="__ptr_")]39 40        riterator_type = "reverse_iterator"41        riterator_children = [42            ValueCheck(),  # Deprecated __t_ member; no need to check43            ValueCheck(name="current"),44        ]45 46        self.expect_expr(47            "a",48            result_type=deque_type,49            result_children=[50                ValueCheck(children=[ValueCheck(value="3")]),51                ValueCheck(children=[ValueCheck(value="1")]),52                ValueCheck(children=[ValueCheck(value="2")]),53            ],54        )55 56        self.expect_expr("a.size()", result_type=size_type, result_value="3")57        self.expect_expr(58            "a.front()", result_type=value_type, result_children=[ValueCheck(value="3")]59        )60        self.expect_expr(61            "a.back()", result_type=value_type, result_children=[ValueCheck(value="2")]62        )63        self.expect_expr("a.front().a", result_type="int", result_value="3")64        self.expect_expr("a.back().a", result_type="int", result_value="2")65 66        self.expect("expr std::reverse(a.begin(), a.end())")67        self.expect_expr("a.front().a", result_type="int", result_value="2")68        self.expect_expr("a.back().a", result_type="int", result_value="3")69 70        self.expect_expr(71            "a.begin()", result_type=iterator_type, result_children=iterator_children72        )73        self.expect_expr(74            "a.rbegin()", result_type=riterator_type, result_children=riterator_children75        )76        self.expect_expr("a.begin()->a", result_type="int", result_value="2")77        self.expect_expr("a.rbegin()->a", result_type="int", result_value="3")78