summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/test/objc-optimized/Makefile8
-rw-r--r--lldb/test/objc-optimized/main.m45
2 files changed, 53 insertions, 0 deletions
diff --git a/lldb/test/objc-optimized/Makefile b/lldb/test/objc-optimized/Makefile
new file mode 100644
index 00000000000..50f10171455
--- /dev/null
+++ b/lldb/test/objc-optimized/Makefile
@@ -0,0 +1,8 @@
+LEVEL = ../make
+
+OBJC_SOURCES := main.m
+
+CFLAGS = -arch $(ARCH) -gdwarf-2 -O2
+LDFLAGS = $(CFLAGS) -lobjc -framework Foundation
+
+include $(LEVEL)/Makefile.rules
diff --git a/lldb/test/objc-optimized/main.m b/lldb/test/objc-optimized/main.m
new file mode 100644
index 00000000000..96a9b93bcad
--- /dev/null
+++ b/lldb/test/objc-optimized/main.m
@@ -0,0 +1,45 @@
+#import <Foundation/Foundation.h>
+
+@interface MyClass : NSObject {
+ int member;
+}
+
+- (id)initWithMember:(int)_member;
+- (NSString*)description;
+@end
+
+@implementation MyClass
+
+- (id)initWithMember:(int)_member
+{
+ if (self = [super init])
+ {
+ member = _member;
+ }
+ return self;
+}
+
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+- (NSString *)description
+{
+ // Set a breakpoint on '-[MyClass description]' and test expressions: expr member
+
+ return [NSString stringWithFormat:@"%d", member];
+}
+@end
+
+int main (int argc, char const *argv[])
+{
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+
+ MyClass *my_object = [[MyClass alloc] initWithMember:5];
+
+ NSLog(@"MyObject %@", [my_object description]);
+
+ [pool release];
+ return 0;
+}
OpenPOWER on IntegriCloud