1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s |
2 | |
3 | __attribute__((weak_import)) @interface WeakRootClass @end |
4 | |
5 | __attribute__((weak_import)) @interface WeakClass : WeakRootClass |
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 | |
31 | // CHECK-X86-64: OBJC_METACLASS_$_WeakRootClass" = extern_weak global |
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 | |
37 | // Root is being implemented here. No extern_weak. |
38 | __attribute__((weak_import)) @interface Root @end |
39 | |
40 | @interface Super : Root @end |
41 | |
42 | @interface Sub : Super @end |
43 | |
44 | @implementation Sub @end |
45 | |
46 | @implementation Root @end |
47 | |
48 | // CHECK-X86-64-NOT: OBJC_METACLASS_$_Root" = extern_weak global |
49 | |