diff --git a/lldb/test/API/lang/swift/objc_implementation/Gadget.h b/lldb/test/API/lang/swift/objc_implementation/Gadget.h new file mode 100644 index 0000000000000..f0cb990036a17 --- /dev/null +++ b/lldb/test/API/lang/swift/objc_implementation/Gadget.h @@ -0,0 +1,13 @@ +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface Gadget : NSObject +@property(nonatomic, assign) NSInteger integer; +@property(nonatomic, assign) BOOL boolean; +@property(nonatomic, strong) NSObject *object; +@property(nonatomic, copy) NSString *string; +@property(nonatomic, copy) NSObject *stringObject; +@end + +NS_ASSUME_NONNULL_END diff --git a/lldb/test/API/lang/swift/objc_implementation/Makefile b/lldb/test/API/lang/swift/objc_implementation/Makefile new file mode 100644 index 0000000000000..51111ac36a3e2 --- /dev/null +++ b/lldb/test/API/lang/swift/objc_implementation/Makefile @@ -0,0 +1,4 @@ +SWIFT_SOURCES = main.swift +SWIFT_BRIDGING_HEADER = Gadget.h +SWIFT_PRECOMPILE_BRIDGING_HEADER = NO +include Makefile.rules diff --git a/lldb/test/API/lang/swift/objc_implementation/TestSwiftObjCImplementation.py b/lldb/test/API/lang/swift/objc_implementation/TestSwiftObjCImplementation.py new file mode 100644 index 0000000000000..000eb891dd3e4 --- /dev/null +++ b/lldb/test/API/lang/swift/objc_implementation/TestSwiftObjCImplementation.py @@ -0,0 +1,29 @@ +import lldb +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +import lldbsuite.test.lldbutil as lldbutil + + +class TestCase(TestBase): + + @swiftTest + @skipUnlessFoundation + def test(self): + self.build() + lldbutil.run_to_source_breakpoint( + self, "break here", lldb.SBFileSpec("main.swift") + ) + self.expect( + "frame var g", + substrs=[ + "integer = 15", + "object = some", + 'stringObject = "Joker"', + ], + # On x86_64, BOOL types have an objc encoding of 'c', which is a + # signed char. The result is in an output of '\x01'. + patterns=[r"boolean = (true|'\\x01')"], + ) + # Swift types that are not representable in ObjC (bridged types such as + # String) are not currently listed in the children. rdar://154046212 + self.expect("frame var g", matching=False, substrs=['string = "Ace"']) diff --git a/lldb/test/API/lang/swift/objc_implementation/main.swift b/lldb/test/API/lang/swift/objc_implementation/main.swift new file mode 100644 index 0000000000000..ad9abfff91af7 --- /dev/null +++ b/lldb/test/API/lang/swift/objc_implementation/main.swift @@ -0,0 +1,15 @@ +@objc @implementation +extension Gadget { + var integer: Int = 15 + var boolean: Bool = true + var object: NSObject = NSObject() + var string: String = "Ace" + var stringObject: NSObject = "Joker" as NSString +} + +func main() { + let g = Gadget() + print("break here") +} + +main()