blob: 201e24b9e5ec6b8800cb1a109bb9a520ff8ab39c [file] [log] [blame]
John McCalld1e40d52011-10-02 01:16:38 +00001// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-X86-64 %s
Fariborz Jahanian269f8bc2009-11-17 22:42:00 +00002
Fariborz Jahanian0e93d252009-12-01 18:25:24 +00003__attribute__((weak_import)) @interface WeakRootClass @end
4
5__attribute__((weak_import)) @interface WeakClass : WeakRootClass
Fariborz Jahanian269f8bc2009-11-17 22:42:00 +00006@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
27int main() {
28 [WeakClass3 message];
29}
30
Fariborz Jahanian0e93d252009-12-01 18:25:24 +000031// CHECK-X86-64: OBJC_METACLASS_$_WeakRootClass" = extern_weak global
Fariborz Jahanian269f8bc2009-11-17 22:42:00 +000032// 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 Jahanian0e93d252009-12-01 18:25:24 +000037// Root is being implemented here. No extern_weak.
38__attribute__((weak_import)) @interface Root @end
Fariborz Jahanian269f8bc2009-11-17 22:42:00 +000039
Fariborz Jahanian0e93d252009-12-01 18:25:24 +000040@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