1 | // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -fdeclspec -fobjc-runtime=ios -fobjc-exceptions -S -emit-llvm -o - %s | FileCheck -allow-deprecated-dag-overlap -check-prefix CHECK-IR %s |
2 | // RUN: %clang_cc1 -triple i686-windows-itanium -fms-extensions -fobjc-runtime=macosx -fdeclspec -fobjc-exceptions -S -emit-llvm -o - %s | FileCheck -allow-deprecated-dag-overlap -check-prefix CHECK-IR %s |
3 | // RUN: %clang_cc1 -triple i686-windows-itanium -fms-extensions -fobjc-runtime=objfw -fdeclspec -fobjc-exceptions -S -emit-llvm -o - %s | FileCheck -allow-deprecated-dag-overlap -check-prefix CHECK-FW %s |
4 | |
5 | // CHECK-IR-DAG: @_objc_empty_cache = external dllimport global %struct._objc_cache |
6 | |
7 | __declspec(dllimport) |
8 | @interface I |
9 | + (instancetype) new; |
10 | @end |
11 | |
12 | // CHECK-IR-DAG: @"OBJC_METACLASS_$_I" = external dllimport global %struct._class_t |
13 | // CHECK-IR-DAG: @"OBJC_CLASS_$_I" = external dllimport global %struct._class_t |
14 | |
15 | __declspec(dllexport) |
16 | @interface J : I |
17 | @end |
18 | |
19 | // CHECK-IR-DAG: @"OBJC_METACLASS_$_J" = dso_local dllexport global %struct._class_t |
20 | // CHECK-IR-DAG: @"OBJC_CLASS_$_J" = dso_local dllexport global %struct._class_t |
21 | |
22 | // CHECK-FW-DAG: @_OBJC_METACLASS_J = dso_local dllexport global |
23 | // CHECK-FW-DAG: @_OBJC_CLASS_J = dso_local dllexport global |
24 | |
25 | @implementation J { |
26 | id _ivar; |
27 | } |
28 | @end |
29 | |
30 | // CHECK-IR-DAG: @"OBJC_IVAR_$_J._ivar" = global i32 |
31 | |
32 | @interface K : J |
33 | @end |
34 | |
35 | // CHECK-IR-DAG: @"OBJC_METACLASS_$_K" = dso_local global %struct._class_t |
36 | // CHECK-IR-DAG: @"OBJC_CLASS_$_K" = dso_local global %struct._class_t |
37 | |
38 | // CHECK-FW-DAG: @_OBJC_METACLASS_K = dso_local global |
39 | // CHECK-FW-DAG: @_OBJC_CLASS_K = dso_local global |
40 | |
41 | @implementation K { |
42 | id _ivar; |
43 | } |
44 | @end |
45 | |
46 | // CHECK-IR-DAG: @"OBJC_IVAR_$_K._ivar" = global i32 |
47 | |
48 | __declspec(dllexport) |
49 | @interface L : K |
50 | @end |
51 | |
52 | // CHECK-IR-DAG: @"OBJC_METACLASS_$_L" = dso_local dllexport global %struct._class_t |
53 | // CHECK-IR-DAG: @"OBJC_CLASS_$_L" = dso_local dllexport global %struct._class_t |
54 | |
55 | // CHECK-FW-DAG: @_OBJC_METACLASS_L = dso_local dllexport global |
56 | // CHECK-FW-DAG: @_OBJC_CLASS_L = dso_local dllexport global |
57 | |
58 | @implementation L { |
59 | id _none; |
60 | |
61 | @public |
62 | id _public; |
63 | |
64 | @protected |
65 | id _protected; |
66 | |
67 | @package |
68 | id _package; |
69 | |
70 | @private |
71 | id _private; |
72 | } |
73 | @end |
74 | |
75 | // CHECK-IR-DAG: @"OBJC_IVAR_$_L._none" = global i32 |
76 | // CHECK-IR-DAG: @"OBJC_IVAR_$_L._public" = dllexport global i32 |
77 | // CHECK-IR-DAG: @"OBJC_IVAR_$_L._protected" = dllexport global i32 |
78 | // CHECK-IR-DAG: @"OBJC_IVAR_$_L._package" = global i32 |
79 | // CHECK-IR-DAG: @"OBJC_IVAR_$_L._private" = global i32 |
80 | |
81 | __declspec(dllimport) |
82 | @interface M : I { |
83 | @public |
84 | id _ivar; |
85 | } |
86 | @end |
87 | |
88 | // CHECK-FW-DAG: @_OBJC_CLASS_M = external dllimport global i32 |
89 | |
90 | // CHECK-IR-DAG: @"OBJC_IVAR_$_M._ivar" = external dllimport global i32 |
91 | |
92 | __declspec(dllexport) |
93 | __attribute__((__objc_exception__)) |
94 | @interface N : I |
95 | @end |
96 | |
97 | // CHECK-FW-DAG: @_OBJC_METACLASS_N = dso_local dllexport global |
98 | // CHECK-FW-DAG: @_OBJC_CLASS_N = dso_local dllexport global |
99 | |
100 | @implementation N : I |
101 | @end |
102 | |
103 | // CHECK-IR-DAG: @"OBJC_EHTYPE_$_N" = dso_local dllexport global %struct._objc_typeinfo |
104 | |
105 | __declspec(dllimport) |
106 | __attribute__((__objc_exception__)) |
107 | @interface O : I |
108 | @end |
109 | |
110 | // CHECK-IR-DAG: @"OBJC_EHTYPE_$_O" = external dllimport global %struct._objc_typeinfo |
111 | |
112 | __attribute__((__objc_exception__)) |
113 | @interface P : I |
114 | @end |
115 | |
116 | // CHECK-IR-DAG: @"OBJC_EHTYPE_$_P" = external dso_local global %struct._objc_typeinfo |
117 | |
118 | @interface Q : M |
119 | @end |
120 | |
121 | id f(Q *q) { |
122 | return q->_ivar; |
123 | } |
124 | |
125 | // CHECK-IR-DAG: @"OBJC_IVAR_$_M._ivar" = external dllimport global i32 |
126 | |
127 | int g() { |
128 | @autoreleasepool { |
129 | M *mi = [M new]; |
130 | @try { |
131 | mi->_ivar = (void *)0; |
132 | @throw(@"CFConstantString"); |
133 | } @catch (id) { |
134 | return 1; |
135 | } @catch (I *) { |
136 | return 2; |
137 | } @catch (J *) { |
138 | return 3; |
139 | } @catch (K *) { |
140 | return 4; |
141 | } @catch (L *) { |
142 | return 5; |
143 | } @catch (M *) { |
144 | return 6; |
145 | } @catch (N *) { |
146 | return 7; |
147 | } @catch (O *) { |
148 | return 8; |
149 | } @catch (P *) { |
150 | return 9; |
151 | } |
152 | } |
153 | return 0; |
154 | } |
155 | |
156 | // CHECK-IR-DAG: @OBJC_EHTYPE_id = external dllimport global %struct._objc_typeinfo |
157 | // CHECK-IR-DAG: @"OBJC_EHTYPE_$_I" = weak global %struct._objc_typeinfo |
158 | // CHECK-IR-DAG: @"OBJC_EHTYPE_$_K" = weak global %struct._objc_typeinfo |
159 | // CHECK-IR-DAG: @"OBJC_EHTYPE_$_L" = weak global %struct._objc_typeinfo |
160 | // CHECK-IR-DAG: @"OBJC_EHTYPE_$_M" = weak global %struct._objc_typeinfo |
161 | |
162 | |