blob: 3179e11b7f399ef9bc5ee2c32d60971f1d87bb98 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -emit-llvm -o %t %s
Fariborz Jahanian83dc3252009-12-09 19:05:56 +00002
3typedef struct objc_class *Class;
4
5typedef struct objc_object {
6 Class isa;
7} *id;
8
9@interface I
10+ (Class) class;
Fariborz Jahanian820bca42009-12-09 23:35:29 +000011- (void)meth : (id)object : (id)src_object;
Fariborz Jahanian83dc3252009-12-09 19:05:56 +000012+ (unsigned char) isSubclassOfClass:(Class)aClass ;
13@end
14
15@implementation I
16+ (Class) class {return 0;}
17+ (unsigned char) isSubclassOfClass:(Class)aClass {return 0;}
Fariborz Jahanian820bca42009-12-09 23:35:29 +000018- (void)meth : (id)object : (id)src_object {
Fariborz Jahanian83dc3252009-12-09 19:05:56 +000019 [object->isa isSubclassOfClass:[I class]];
20
21 [(*object).isa isSubclassOfClass:[I class]];
Fariborz Jahanian820bca42009-12-09 23:35:29 +000022
23 object->isa = src_object->isa;
24 (*src_object).isa = (*object).isa;
Fariborz Jahanian83dc3252009-12-09 19:05:56 +000025}
26@end
27
Fariborz Jahaniana7fa7cd2009-12-15 21:34:52 +000028
29// rdar 7470820
30static Class MyClass;
31
32Class Test(const void *inObject1) {
33 if(((id)inObject1)->isa == MyClass)
34 return ((id)inObject1)->isa;
35 return (id)0;
36}
Fariborz Jahanian5ed676c2010-02-05 19:18:30 +000037
38// rdar 7609722
39@interface Foo {
40@public
41 id isa;
42}
43+(id)method;
44@end
45
46id Test2() {
47 if([Foo method]->isa)
48 return (*[Foo method]).isa;
49 return [Foo method]->isa;
50}