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
20  mydir = TestBase.compute_mydir(__file__)
21
22  @skipIf(compiler="clang", compiler_version=['<', '7.0'])
23  def test_argument_passing_restrictions(self):
24    self.build()
25
26    lldbutil.run_to_source_breakpoint(self, '// break here',
27            lldb.SBFileSpec("main.cpp"))
28
29    self.expect_expr("returnPassByRef()", result_type="PassByRef", result_children=[
30        ValueCheck(name="x", value="11223344")
31    ])
32
33    self.expect_expr("takePassByRef(p)", result_type="int", result_value="42")
34