forked from OSchip/llvm-project
Added a code for a test to find the real Objective C class definition. I
still need to write the test case file. llvm-svn: 145756
This commit is contained in:
parent
a0544d6fdf
commit
dfb6dc9187
|
@ -0,0 +1,12 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class InternalClass;
|
||||
|
||||
@interface Bar : NSObject {
|
||||
@private
|
||||
InternalClass *storage;
|
||||
}
|
||||
|
||||
- (NSString *)description;
|
||||
|
||||
@end
|
|
@ -0,0 +1,43 @@
|
|||
#import "Bar.h"
|
||||
|
||||
@interface InternalClass : NSObject {
|
||||
@public
|
||||
NSString *foo;
|
||||
NSString *bar;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation InternalClass
|
||||
@end
|
||||
|
||||
@interface Bar ()
|
||||
{
|
||||
NSString *_hidden_ivar;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@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];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "Bar.h"
|
||||
|
||||
@interface Foo : NSObject {
|
||||
Bar *_bar;
|
||||
}
|
||||
|
||||
- (NSString *)description;
|
||||
|
||||
@end
|
|
@ -0,0 +1,25 @@
|
|||
#import "Foo.h"
|
||||
|
||||
@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];
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,6 @@
|
|||
LEVEL = ../../../make
|
||||
|
||||
OBJC_SOURCES := Bar.m Foo.m main.m
|
||||
LDFLAGS = $(CFLAGS) -lobjc -framework Foundation
|
||||
|
||||
include $(LEVEL)/Makefile.rules
|
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue