comparison clang/test/SemaObjC/unguarded-availability.m @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 1d019706d866
children c4bab56944e8
comparison
equal deleted inserted replaced
173:0572611fdcc8 207:2e18cbf3894f
123 123
124 void test_blocks() { 124 void test_blocks() {
125 (void) ^{ 125 (void) ^{
126 func_10_12(); // expected-warning{{'func_10_12' is only available on macOS 10.12 or newer}} expected-note{{@available}} 126 func_10_12(); // expected-warning{{'func_10_12' is only available on macOS 10.12 or newer}} expected-note{{@available}}
127 }; 127 };
128
129 if (@available(macos 10.12, *))
130 (void) ^{
131 func_10_12();
132 (void) ^{
133 func_10_12();
134 };
135 };
128 } 136 }
129 137
130 void test_params(int_10_12 x); // expected-warning {{'int_10_12' is only available on macOS 10.12 or newer}} expected-note{{annotate 'test_params' with an availability attribute to silence this warning}} 138 void test_params(int_10_12 x); // expected-warning {{'int_10_12' is only available on macOS 10.12 or newer}} expected-note{{annotate 'test_params' with an availability attribute to silence this warning}}
131 139
132 void test_params2(int_10_12 x) AVAILABLE_10_12; // no warn 140 void test_params2(int_10_12 x) AVAILABLE_10_12; // no warn
231 func_10_12(); // expected-warning{{'func_10_12' is only available on macOS 10.12 or newer}} expected-note{{@available}} 239 func_10_12(); // expected-warning{{'func_10_12' is only available on macOS 10.12 or newer}} expected-note{{@available}}
232 }); 240 });
233 (void)(^ { 241 (void)(^ {
234 func_10_12(); // expected-warning{{'func_10_12' is only available on macOS 10.12 or newer}} expected-note{{@available}} 242 func_10_12(); // expected-warning{{'func_10_12' is only available on macOS 10.12 or newer}} expected-note{{@available}}
235 }); 243 });
244
245 if (@available(macos 10.12, *)) {
246 void([]() {
247 func_10_12();
248 void([] () {
249 func_10_12();
250 });
251 struct DontWarn {
252 void f() {
253 func_10_12();
254 }
255 };
256 });
257 }
258
259 if (@available(macos 10.12, *)) {
260 struct DontWarn {
261 void f() {
262 func_10_12();
263 void([] () {
264 func_10_12();
265 });
266 struct DontWarn2 {
267 void f() {
268 func_10_12();
269 }
270 };
271 }
272 };
273 }
236 } 274 }
237 275
238 #endif 276 #endif
239 277
240 struct InStruct { // expected-note{{annotate 'InStruct' with an availability attribute to silence}} 278 struct InStruct { // expected-note{{annotate 'InStruct' with an availability attribute to silence}}
257 @interface Proper // expected-note{{annotate 'Proper' with an availability attribute}} 295 @interface Proper // expected-note{{annotate 'Proper' with an availability attribute}}
258 @property (class) new_int x; // expected-warning{{'new_int' is only available}} 296 @property (class) new_int x; // expected-warning{{'new_int' is only available}}
259 @end 297 @end
260 298
261 void with_local_struct() { 299 void with_local_struct() {
262 struct local { // expected-note{{annotate 'local' with an availability attribute}} 300 struct local {
263 new_int x; // expected-warning{{'new_int' is only available}} 301 new_int x; // expected-warning{{'new_int' is only available}} expected-note{{enclose 'new_int' in an @available check}}
264 }; 302 };
303 if (@available(macos 10.12, *)) {
304 struct DontWarn {
305 new_int x;
306 };
307 }
265 } 308 }
266 309
267 // rdar://33156429: 310 // rdar://33156429:
268 // Avoid the warning on protocol requirements. 311 // Avoid the warning on protocol requirements.
269 312