[Lldb-commits] [lldb] r126980 - in /lldb/trunk/test/objc-optimized: ./ Makefile main.m
Johnny Chen
johnny.chen at apple.com
Thu Mar 3 17:54:19 PST 2011
Author: johnny
Date: Thu Mar 3 19:54:19 2011
New Revision: 126980
URL: http://llvm.org/viewvc/llvm-project?rev=126980&view=rev
Log:
Add objc source file and Makefile. Test case to follow.
Added:
lldb/trunk/test/objc-optimized/
lldb/trunk/test/objc-optimized/Makefile
lldb/trunk/test/objc-optimized/main.m
Added: lldb/trunk/test/objc-optimized/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/objc-optimized/Makefile?rev=126980&view=auto
==============================================================================
--- lldb/trunk/test/objc-optimized/Makefile (added)
+++ lldb/trunk/test/objc-optimized/Makefile Thu Mar 3 19:54:19 2011
@@ -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
Added: lldb/trunk/test/objc-optimized/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/objc-optimized/main.m?rev=126980&view=auto
==============================================================================
--- lldb/trunk/test/objc-optimized/main.m (added)
+++ lldb/trunk/test/objc-optimized/main.m Thu Mar 3 19:54:19 2011
@@ -0,0 +1,45 @@
+#import <Foundation/Foundation.h>
+
+ at interface MyClass : NSObject {
+ int member;
+}
+
+- (id)initWithMember:(int)_member;
+- (NSString*)description;
+ at end
+
+ at 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];
+}
+ at 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;
+}
More information about the lldb-commits
mailing list