1"""
2This is a test to ensure that both lldb is reconstructing the right
3calling convention for a CXXRecordDecl as represented by:
4
5   DW_CC_pass_by_reference
6   DW_CC_pass_by_value
7
8and to also make sure that the ASTImporter is copying over this
9setting when importing the CXXRecordDecl via setArgPassingRestrictions.
10"""
11
12import lldb
13from lldbsuite.test.decorators import *
14from lldbsuite.test.lldbtest import *
15from lldbsuite.test import lldbutil
16
17
18class TestArgumentPassingRestrictions(TestBase):
19    @skipIf(compiler="clang", compiler_version=["<", "7.0"])
20    def test_argument_passing_restrictions(self):
21        self.build()
22
23        lldbutil.run_to_source_breakpoint(
24            self, "// break here", lldb.SBFileSpec("main.cpp")
25        )
26
27        self.expect_expr(
28            "returnPassByRef()",
29            result_type="PassByRef",
30            result_children=[ValueCheck(name="x", value="11223344")],
31        )
32
33        self.expect_expr("takePassByRef(p)", result_type="int", result_value="42")
34