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