Alex Lorenz | 3cfe9d5 | 2019-01-24 19:14:39 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple arm64-apple-tvos12.0 -fsyntax-only -verify %s |
| 2 | |
| 3 | void explicit() __attribute__((availability(tvos, introduced=11.0, deprecated=12.0))); // expected-note {{marked deprecated here}} |
| 4 | void inferred() __attribute__((availability(ios, introduced=11.0, deprecated=12.0))); // expected-note {{marked deprecated here}} |
| 5 | void explicitOverInferred() |
| 6 | __attribute__((availability(ios, introduced=11.0, deprecated=12.0))) |
| 7 | __attribute__((availability(tvos, introduced=11.0))); |
| 8 | void explicitOverInferred2() |
| 9 | __attribute__((availability(tvos, introduced=11.0))) |
| 10 | __attribute__((availability(ios, introduced=11.0, deprecated=12.0))); |
| 11 | |
| 12 | void simpleUsage() { |
| 13 | explicit(); // expected-warning{{'explicit' is deprecated: first deprecated in tvOS 12.0}} |
| 14 | inferred(); // expected-warning{{'inferred' is deprecated: first deprecated in tvOS 12.0}} |
| 15 | // ok, not deprecated for tvOS. |
| 16 | explicitOverInferred(); |
| 17 | explicitOverInferred2(); |
| 18 | } |
| 19 | |
| 20 | #pragma clang attribute push (__attribute__((availability(tvos, introduced=11.0, deprecated=12.0))), apply_to=function) |
| 21 | |
| 22 | void explicitFromPragma(); // expected-note {{marked deprecated here}} |
| 23 | void explicitWinsOverExplicitFromPragma() __attribute__((availability(tvos, introduced=11.0))); |
| 24 | void implicitLosesOverExplicitFromPragma() __attribute__((availability(ios, introduced=11.0))); // expected-note {{marked deprecated here}} |
| 25 | |
| 26 | #pragma clang attribute pop |
| 27 | |
| 28 | #pragma clang attribute push (__attribute__((availability(ios, introduced=11.0, deprecated=12.0))), apply_to=function) |
| 29 | |
| 30 | void implicitFromPragma(); // expected-note {{marked deprecated here}} |
| 31 | void explicitWinsOverImplicitFromPragma() __attribute__((availability(tvos, introduced=11.0))); |
| 32 | void implicitWinsOverImplicitFromPragma() __attribute__((availability(ios, introduced=11.0))); |
| 33 | |
| 34 | #pragma clang attribute pop |
| 35 | |
| 36 | #pragma clang attribute push (__attribute__((availability(tvos, introduced=11.0, deprecated=12.0))), apply_to=function) |
| 37 | #pragma clang attribute push (__attribute__((availability(ios, introduced=11.0, deprecated=11.3))), apply_to=function) |
| 38 | |
| 39 | void pragmaExplicitWinsOverPragmaImplicit(); // expected-note {{marked deprecated here}} |
| 40 | |
| 41 | #pragma clang attribute pop |
| 42 | #pragma clang attribute pop |
| 43 | |
| 44 | void pragmaUsage() { |
| 45 | explicitFromPragma(); // expected-warning {{'explicitFromPragma' is deprecated: first deprecated in tvOS 12.0}} |
| 46 | explicitWinsOverExplicitFromPragma(); // ok |
| 47 | implicitLosesOverExplicitFromPragma(); // expected-warning {{'implicitLosesOverExplicitFromPragma' is deprecated: first deprecated in tvOS 12.0}} |
| 48 | |
| 49 | implicitFromPragma(); // expected-warning {{'implicitFromPragma' is deprecated: first deprecated in tvOS 12.0}} |
| 50 | explicitWinsOverImplicitFromPragma(); // ok |
| 51 | implicitWinsOverImplicitFromPragma(); // ok |
| 52 | pragmaExplicitWinsOverPragmaImplicit(); // expected-warning {{'pragmaExplicitWinsOverPragmaImplicit' is deprecated: first deprecated in tvOS 12.0}} |
| 53 | } |