[Lldb-commits] [lldb] r145756 - in /lldb/trunk/test/lang/objc/real-definition: ./ Bar.h Bar.m Foo.h Foo.m Makefile main.m

Greg Clayton gclayton at apple.com
Fri Dec 2 22:35:52 CST 2011


Author: gclayton
Date: Fri Dec  2 22:35:51 2011
New Revision: 145756

URL: http://llvm.org/viewvc/llvm-project?rev=145756&view=rev
Log:
Added a code for a test to find the real Objective C class definition. I 
still need to write the test case file.


Added:
    lldb/trunk/test/lang/objc/real-definition/
    lldb/trunk/test/lang/objc/real-definition/Bar.h
    lldb/trunk/test/lang/objc/real-definition/Bar.m
    lldb/trunk/test/lang/objc/real-definition/Foo.h
    lldb/trunk/test/lang/objc/real-definition/Foo.m
    lldb/trunk/test/lang/objc/real-definition/Makefile
    lldb/trunk/test/lang/objc/real-definition/main.m

Added: lldb/trunk/test/lang/objc/real-definition/Bar.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/real-definition/Bar.h?rev=145756&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/real-definition/Bar.h (added)
+++ lldb/trunk/test/lang/objc/real-definition/Bar.h Fri Dec  2 22:35:51 2011
@@ -0,0 +1,12 @@
+#import <Foundation/Foundation.h>
+
+ at class InternalClass;
+
+ at interface Bar : NSObject {
+    @private
+    InternalClass *storage;
+}
+
+- (NSString *)description;
+
+ at end
\ No newline at end of file

Added: lldb/trunk/test/lang/objc/real-definition/Bar.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/real-definition/Bar.m?rev=145756&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/real-definition/Bar.m (added)
+++ lldb/trunk/test/lang/objc/real-definition/Bar.m Fri Dec  2 22:35:51 2011
@@ -0,0 +1,43 @@
+#import "Bar.h"
+
+ at interface InternalClass : NSObject {
+    @public
+    NSString *foo;
+    NSString *bar;
+}
+ at end
+
+ at implementation InternalClass
+ at end
+
+ at interface Bar () 
+{
+    NSString *_hidden_ivar;
+}
+
+ at end
+
+ at implementation Bar
+
+- (id)init
+{
+    self = [super init];
+    if (self) {
+        _hidden_ivar = [NSString stringWithFormat:@"%p: @Bar", self];
+    }
+    return self;    
+}
+
+- (void)dealloc
+{
+    [_hidden_ivar release];
+    [super dealloc];
+}
+
+- (NSString *)description
+{
+    return [_hidden_ivar copyWithZone:NULL];
+}
+
+ at end
+ 
\ No newline at end of file

Added: lldb/trunk/test/lang/objc/real-definition/Foo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/real-definition/Foo.h?rev=145756&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/real-definition/Foo.h (added)
+++ lldb/trunk/test/lang/objc/real-definition/Foo.h Fri Dec  2 22:35:51 2011
@@ -0,0 +1,11 @@
+#import <Foundation/Foundation.h>
+
+#import "Bar.h"
+
+ at interface Foo : NSObject {
+    Bar *_bar;
+}
+
+- (NSString *)description;
+
+ at end
\ No newline at end of file

Added: lldb/trunk/test/lang/objc/real-definition/Foo.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/real-definition/Foo.m?rev=145756&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/real-definition/Foo.m (added)
+++ lldb/trunk/test/lang/objc/real-definition/Foo.m Fri Dec  2 22:35:51 2011
@@ -0,0 +1,25 @@
+#import "Foo.h"
+
+ at implementation Foo
+
+- (id)init
+{
+    self = [super init];
+    if (self) {
+        _bar = [[Bar alloc] init];
+    }
+    return self;    
+}
+
+- (void)dealloc
+{
+    [_bar release];
+    [super dealloc];
+}
+
+- (NSString *)description
+{
+    return [NSString stringWithFormat:@"%p: @Foo { _bar = %@ }", self, _bar];
+}
+
+ at end

Added: lldb/trunk/test/lang/objc/real-definition/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/real-definition/Makefile?rev=145756&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/real-definition/Makefile (added)
+++ lldb/trunk/test/lang/objc/real-definition/Makefile Fri Dec  2 22:35:51 2011
@@ -0,0 +1,6 @@
+LEVEL = ../../../make
+
+OBJC_SOURCES := Bar.m Foo.m main.m
+LDFLAGS = $(CFLAGS) -lobjc -framework Foundation
+
+include $(LEVEL)/Makefile.rules

Added: lldb/trunk/test/lang/objc/real-definition/main.m
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/objc/real-definition/main.m?rev=145756&view=auto
==============================================================================
--- lldb/trunk/test/lang/objc/real-definition/main.m (added)
+++ lldb/trunk/test/lang/objc/real-definition/main.m Fri Dec  2 22:35:51 2011
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdint.h>
+#import <Foundation/Foundation.h>
+#import "Foo.h"
+
+int main (int argc, char const *argv[])
+{
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+    Foo *foo = [[Foo alloc] init];
+    NSLog (@"foo is %@", foo);
+    [pool release];
+    return 0;
+}




More information about the lldb-commits mailing list