xref: /llvm-project/clang/test/SemaObjC/attr-availability-priority.m (revision 22db4824b9e03fe8c2e9217d6832b71ac23c175f)
13cfe9d5cSAlex Lorenz// RUN: %clang_cc1 -triple arm64-apple-tvos12.0 -fsyntax-only -verify %s
23cfe9d5cSAlex Lorenz
3*22db4824SAaron Ballmanvoid explicit(void) __attribute__((availability(tvos, introduced=11.0, deprecated=12.0))); // expected-note {{marked deprecated here}}
4*22db4824SAaron Ballmanvoid inferred(void) __attribute__((availability(ios, introduced=11.0, deprecated=12.0))); // expected-note {{marked deprecated here}}
5*22db4824SAaron Ballmanvoid explicitOverInferred(void)
63cfe9d5cSAlex Lorenz__attribute__((availability(ios, introduced=11.0, deprecated=12.0)))
73cfe9d5cSAlex Lorenz__attribute__((availability(tvos, introduced=11.0)));
8*22db4824SAaron Ballmanvoid explicitOverInferred2(void)
93cfe9d5cSAlex Lorenz__attribute__((availability(tvos, introduced=11.0)))
103cfe9d5cSAlex Lorenz__attribute__((availability(ios, introduced=11.0, deprecated=12.0)));
113cfe9d5cSAlex Lorenz
12*22db4824SAaron Ballmanvoid simpleUsage(void) {
133cfe9d5cSAlex Lorenz  explicit(); // expected-warning{{'explicit' is deprecated: first deprecated in tvOS 12.0}}
143cfe9d5cSAlex Lorenz  inferred(); // expected-warning{{'inferred' is deprecated: first deprecated in tvOS 12.0}}
153cfe9d5cSAlex Lorenz  // ok, not deprecated for tvOS.
163cfe9d5cSAlex Lorenz  explicitOverInferred();
173cfe9d5cSAlex Lorenz  explicitOverInferred2();
183cfe9d5cSAlex Lorenz}
193cfe9d5cSAlex Lorenz
203cfe9d5cSAlex Lorenz#pragma clang attribute push (__attribute__((availability(tvos, introduced=11.0, deprecated=12.0))), apply_to=function)
213cfe9d5cSAlex Lorenz
22*22db4824SAaron Ballmanvoid explicitFromPragma(void); // expected-note {{marked deprecated here}}
23*22db4824SAaron Ballmanvoid explicitWinsOverExplicitFromPragma(void) __attribute__((availability(tvos, introduced=11.0)));
24*22db4824SAaron Ballmanvoid implicitLosesOverExplicitFromPragma(void) __attribute__((availability(ios, introduced=11.0))); // expected-note {{marked deprecated here}}
253cfe9d5cSAlex Lorenz
263cfe9d5cSAlex Lorenz#pragma clang attribute pop
273cfe9d5cSAlex Lorenz
283cfe9d5cSAlex Lorenz#pragma clang attribute push (__attribute__((availability(ios, introduced=11.0, deprecated=12.0))), apply_to=function)
293cfe9d5cSAlex Lorenz
30*22db4824SAaron Ballmanvoid implicitFromPragma(void); // expected-note {{marked deprecated here}}
31*22db4824SAaron Ballmanvoid explicitWinsOverImplicitFromPragma(void) __attribute__((availability(tvos, introduced=11.0)));
32*22db4824SAaron Ballmanvoid implicitWinsOverImplicitFromPragma(void) __attribute__((availability(ios, introduced=11.0)));
333cfe9d5cSAlex Lorenz
343cfe9d5cSAlex Lorenz#pragma clang attribute pop
353cfe9d5cSAlex Lorenz
363cfe9d5cSAlex Lorenz#pragma clang attribute push (__attribute__((availability(tvos, introduced=11.0, deprecated=12.0))), apply_to=function)
373cfe9d5cSAlex Lorenz#pragma clang attribute push (__attribute__((availability(ios, introduced=11.0, deprecated=11.3))), apply_to=function)
383cfe9d5cSAlex Lorenz
39*22db4824SAaron Ballmanvoid pragmaExplicitWinsOverPragmaImplicit(void); // expected-note {{marked deprecated here}}
403cfe9d5cSAlex Lorenz
413cfe9d5cSAlex Lorenz#pragma clang attribute pop
423cfe9d5cSAlex Lorenz#pragma clang attribute pop
433cfe9d5cSAlex Lorenz
44*22db4824SAaron Ballmanvoid pragmaUsage(void) {
453cfe9d5cSAlex Lorenz  explicitFromPragma(); // expected-warning {{'explicitFromPragma' is deprecated: first deprecated in tvOS 12.0}}
463cfe9d5cSAlex Lorenz  explicitWinsOverExplicitFromPragma(); // ok
473cfe9d5cSAlex Lorenz  implicitLosesOverExplicitFromPragma(); // expected-warning {{'implicitLosesOverExplicitFromPragma' is deprecated: first deprecated in tvOS 12.0}}
483cfe9d5cSAlex Lorenz
493cfe9d5cSAlex Lorenz  implicitFromPragma(); // expected-warning {{'implicitFromPragma' is deprecated: first deprecated in tvOS 12.0}}
503cfe9d5cSAlex Lorenz  explicitWinsOverImplicitFromPragma(); // ok
513cfe9d5cSAlex Lorenz  implicitWinsOverImplicitFromPragma(); // ok
523cfe9d5cSAlex Lorenz  pragmaExplicitWinsOverPragmaImplicit(); // expected-warning {{'pragmaExplicitWinsOverPragmaImplicit' is deprecated: first deprecated in tvOS 12.0}}
533cfe9d5cSAlex Lorenz}
54