aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc-obj-c++-shared/Object1-implementation.h
blob: 4c38383ac4314ee77e8259c6807bee7099f56fe6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* This provides a minimal implementation of the Object root class.
 * It is split from the definition so that it can be placed
 * at the end of source files that require it.  This reduces
 * clutter in .s and other internmediate code while debugging.
*/
#ifndef _OBJC_OBJECT1_IMPLEMENTATION_H_
#define _OBJC_OBJECT1_IMPLEMENTATION_H_
#ifdef DO_NEXT_M64_OBJECT_IMPLEMENTATION
@implementation Object

+ initialize {
     return self;
}
- init {
     return self;
}

+ class {
    return object_getClass(self);
}

+ new {
     return [[self alloc] init];
}

+ free {
     return nil;
}

- free {
     return object_dispose(self);
}

+ alloc {
     return class_createInstance(self, 0);
}


- class {
     return isa;
}


- superclass {
     return class_getSuperclass([self class]);
}

- (const char *) name {
     return class_getName([self class]);
}

-(BOOL)conformsTo:(Protocol *)protocol {
     Class cls;
     for (cls = [self class]; cls; cls = [cls superclass]) {
         if (class_conformsToProtocol(cls, protocol)) return YES;
     }
     return NO;
}

@end
#endif /* NEEDS_OBJECT_IMPLEMENTATION */
#endif /* _OBJC_OBJECT1_IMPLEMENTATION_H_ */