Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -o %t %s |
Fariborz Jahanian | 83dc325 | 2009-12-09 19:05:56 +0000 | [diff] [blame] | 2 | |
| 3 | typedef struct objc_class *Class; |
| 4 | |
| 5 | typedef struct objc_object { |
| 6 | Class isa; |
| 7 | } *id; |
| 8 | |
| 9 | @interface I |
| 10 | + (Class) class; |
Fariborz Jahanian | 820bca4 | 2009-12-09 23:35:29 +0000 | [diff] [blame] | 11 | - (void)meth : (id)object : (id)src_object; |
Fariborz Jahanian | 83dc325 | 2009-12-09 19:05:56 +0000 | [diff] [blame] | 12 | + (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 Jahanian | 820bca4 | 2009-12-09 23:35:29 +0000 | [diff] [blame] | 18 | - (void)meth : (id)object : (id)src_object { |
Fariborz Jahanian | 83dc325 | 2009-12-09 19:05:56 +0000 | [diff] [blame] | 19 | [object->isa isSubclassOfClass:[I class]]; |
| 20 | |
| 21 | [(*object).isa isSubclassOfClass:[I class]]; |
Fariborz Jahanian | 820bca4 | 2009-12-09 23:35:29 +0000 | [diff] [blame] | 22 | |
| 23 | object->isa = src_object->isa; |
| 24 | (*src_object).isa = (*object).isa; |
Fariborz Jahanian | 83dc325 | 2009-12-09 19:05:56 +0000 | [diff] [blame] | 25 | } |
| 26 | @end |
| 27 | |
Fariborz Jahanian | a7fa7cd | 2009-12-15 21:34:52 +0000 | [diff] [blame] | 28 | |
| 29 | // rdar 7470820 |
| 30 | static Class MyClass; |
| 31 | |
| 32 | Class Test(const void *inObject1) { |
| 33 | if(((id)inObject1)->isa == MyClass) |
| 34 | return ((id)inObject1)->isa; |
| 35 | return (id)0; |
| 36 | } |
Fariborz Jahanian | 5ed676c | 2010-02-05 19:18:30 +0000 | [diff] [blame] | 37 | |
| 38 | // rdar 7609722 |
| 39 | @interface Foo { |
| 40 | @public |
| 41 | id isa; |
| 42 | } |
| 43 | +(id)method; |
| 44 | @end |
| 45 | |
| 46 | id Test2() { |
| 47 | if([Foo method]->isa) |
| 48 | return (*[Foo method]).isa; |
| 49 | return [Foo method]->isa; |
| 50 | } |