xref: /llvm-project/lldb/test/API/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py (revision 1c6826e8fc6d5c47c3ffff573efd8d080939a932)
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    @add_test_categories(["gmodules"])
15    @skipIf(macos_version=["<", "10.12"])
16    def test_expr(self):
17        self.build()
18        exe = self.getBuildArtifact("a.out")
19        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
20
21        # Break inside the foo function which takes a bar_ptr argument.
22        lldbutil.run_to_source_breakpoint(
23            self, '// Set breakpoint here.', lldb.SBFileSpec('main.m'))
24
25        self.runCmd(
26            "settings set target.clang-module-search-paths \"" +
27            self.getSourceDir() +
28            "\"")
29
30        self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY,
31                    substrs=["int", "3"])
32
33        self.expect("expr isInline(2)", VARIABLES_DISPLAYED_CORRECTLY,
34                    substrs=["4"])
35