xref: /llvm-project/lldb/test/API/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py (revision 95367da43ddd16fc9c4cbe06a1823119f7841f48)
1"""Test that inline functions from modules are imported correctly"""
2
3
4
5
6import lldb
7from lldbsuite.test.decorators import *
8from lldbsuite.test.lldbtest import *
9from lldbsuite.test import lldbutil
10
11
12class ModulesInlineFunctionsTestCase(TestBase):
13
14    @skipIf(macos_version=["<", "10.12"], debug_info=no_match(["gmodules"]))
15    def test_expr(self):
16        self.build()
17        exe = self.getBuildArtifact("a.out")
18        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
19
20        # Break inside the foo function which takes a bar_ptr argument.
21        lldbutil.run_to_source_breakpoint(
22            self, '// Set breakpoint here.', lldb.SBFileSpec('main.m'))
23
24        self.runCmd(
25            "settings set target.clang-module-search-paths \"" +
26            self.getSourceDir() +
27            "\"")
28
29        self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY,
30                    substrs=["int", "3"])
31
32        self.expect("expr isInline(2)", VARIABLES_DISPLAYED_CORRECTLY,
33                    substrs=["4"])
34