Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fobjc-nonfragile-abi -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s |
Fariborz Jahanian | 269f8bc | 2009-11-17 22:42:00 +0000 | [diff] [blame] | 2 | |
Fariborz Jahanian | 0e93d25 | 2009-12-01 18:25:24 +0000 | [diff] [blame] | 3 | __attribute__((weak_import)) @interface WeakRootClass @end |
| 4 | |
| 5 | __attribute__((weak_import)) @interface WeakClass : WeakRootClass |
Fariborz Jahanian | 269f8bc | 2009-11-17 22:42:00 +0000 | [diff] [blame] | 6 | @end |
| 7 | |
| 8 | @interface MySubclass : WeakClass @end |
| 9 | |
| 10 | @implementation MySubclass @end |
| 11 | |
| 12 | @implementation WeakClass(MyCategory) @end |
| 13 | |
| 14 | |
| 15 | __attribute__((weak_import)) |
| 16 | @interface WeakClass1 @end |
| 17 | |
| 18 | @implementation WeakClass1(MyCategory) @end |
| 19 | |
| 20 | @implementation WeakClass1(YourCategory) @end |
| 21 | |
| 22 | __attribute__((weak_import)) |
| 23 | @interface WeakClass3 |
| 24 | + message; |
| 25 | @end |
| 26 | |
| 27 | int main() { |
| 28 | [WeakClass3 message]; |
| 29 | } |
| 30 | |
Fariborz Jahanian | 0e93d25 | 2009-12-01 18:25:24 +0000 | [diff] [blame] | 31 | // CHECK-X86-64: OBJC_METACLASS_$_WeakRootClass" = extern_weak global |
Fariborz Jahanian | 269f8bc | 2009-11-17 22:42:00 +0000 | [diff] [blame] | 32 | // CHECK-X86-64: OBJC_METACLASS_$_WeakClass" = extern_weak global |
| 33 | // CHECK-X86-64: OBJC_CLASS_$_WeakClass" = extern_weak global |
| 34 | // CHECK-X86-64: OBJC_CLASS_$_WeakClass1" = extern_weak global |
| 35 | // CHECK-X86-64: OBJC_CLASS_$_WeakClass3" = extern_weak global |
| 36 | |
Fariborz Jahanian | 0e93d25 | 2009-12-01 18:25:24 +0000 | [diff] [blame] | 37 | // Root is being implemented here. No extern_weak. |
| 38 | __attribute__((weak_import)) @interface Root @end |
Fariborz Jahanian | 269f8bc | 2009-11-17 22:42:00 +0000 | [diff] [blame] | 39 | |
Fariborz Jahanian | 0e93d25 | 2009-12-01 18:25:24 +0000 | [diff] [blame] | 40 | @interface Super : Root @end |
| 41 | |
| 42 | @interface Sub : Super @end |
| 43 | |
| 44 | @implementation Sub @end |
| 45 | |
| 46 | @implementation Root @end |
| 47 | |
| 48 | // CHECK-NOT-X86-64: OBJC_METACLASS_$_Root" = extern_weak global |