diff --git a/lldb/test/API/lang/swift/expression/classes/open_resilient/Library.swift b/lldb/test/API/lang/swift/expression/classes/open_resilient/Library.swift new file mode 100644 index 0000000000000..9ea79076e09da --- /dev/null +++ b/lldb/test/API/lang/swift/expression/classes/open_resilient/Library.swift @@ -0,0 +1,4 @@ +open class A { + public init() {} + open func foo() -> Int { return 23 } +} diff --git a/lldb/test/API/lang/swift/expression/classes/open_resilient/Makefile b/lldb/test/API/lang/swift/expression/classes/open_resilient/Makefile new file mode 100644 index 0000000000000..e4515a44a48ea --- /dev/null +++ b/lldb/test/API/lang/swift/expression/classes/open_resilient/Makefile @@ -0,0 +1,14 @@ +SWIFT_SOURCES := main.swift +SWIFTFLAGS_EXTRAS := -I. +LD_EXTRAS = -lLibrary -L$(BUILDDIR) +all: libLibrary.dylib a.out + +lib%.dylib: %.swift + "$(MAKE)" MAKE_DSYM=NO DYLIB_ONLY=YES \ + DYLIB_HIDE_SWIFTMODULE=YES \ + DYLIB_NAME=$(shell basename $< .swift) \ + DYLIB_SWIFT_SOURCES=$(shell basename $<) \ + SWIFTFLAGS_EXTRAS=-enable-library-evolution \ + VPATH=$(SRCDIR) -I $(SRCDIR) -f $(MAKEFILE_RULES) all + +include Makefile.rules diff --git a/lldb/test/API/lang/swift/expression/classes/open_resilient/TestSwiftExpressionOpenResilientClass.py b/lldb/test/API/lang/swift/expression/classes/open_resilient/TestSwiftExpressionOpenResilientClass.py new file mode 100644 index 0000000000000..42347a0aba262 --- /dev/null +++ b/lldb/test/API/lang/swift/expression/classes/open_resilient/TestSwiftExpressionOpenResilientClass.py @@ -0,0 +1,16 @@ +import lldb +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +import lldbsuite.test.lldbutil as lldbutil + +class TestExpressionOpenResilientClass(TestBase): + NO_DEBUG_INFO_TEST = True + @swiftTest + def test(self): + """Tests calling an open resilient function""" + self.build() + lldbutil.run_to_source_breakpoint( + self, 'break here', lldb.SBFileSpec('main.swift'), + extra_images=['Library']) + + self.expect("expr -- a.foo()", substrs=["23"]) diff --git a/lldb/test/API/lang/swift/expression/classes/open_resilient/main.swift b/lldb/test/API/lang/swift/expression/classes/open_resilient/main.swift new file mode 100644 index 0000000000000..0cf6cfddaeee8 --- /dev/null +++ b/lldb/test/API/lang/swift/expression/classes/open_resilient/main.swift @@ -0,0 +1,8 @@ +import Library + +func f() { + let a = A() + print("break here \(a)") +} + +f()