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