mirror of https://github.com/microsoft/clang.git
Allow pretty platform names in availability attributes
rdar://32076651 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310921 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bcc9bb7226
commit
c3ca0b5132
|
@ -912,13 +912,18 @@ void Parser::ParseAvailabilityAttribute(IdentifierInfo &Availability,
|
|||
return;
|
||||
}
|
||||
IdentifierLoc *Platform = ParseIdentifierLoc();
|
||||
// Canonicalize platform name from "macosx" to "macos".
|
||||
if (Platform->Ident && Platform->Ident->getName() == "macosx")
|
||||
Platform->Ident = PP.getIdentifierInfo("macos");
|
||||
// Canonicalize platform name from "macosx_app_extension" to
|
||||
// "macos_app_extension".
|
||||
if (Platform->Ident && Platform->Ident->getName() == "macosx_app_extension")
|
||||
Platform->Ident = PP.getIdentifierInfo("macos_app_extension");
|
||||
if (const IdentifierInfo *const Ident = Platform->Ident) {
|
||||
// Canonicalize platform name from "macosx" to "macos".
|
||||
if (Ident->getName() == "macosx")
|
||||
Platform->Ident = PP.getIdentifierInfo("macos");
|
||||
// Canonicalize platform name from "macosx_app_extension" to
|
||||
// "macos_app_extension".
|
||||
else if (Ident->getName() == "macosx_app_extension")
|
||||
Platform->Ident = PP.getIdentifierInfo("macos_app_extension");
|
||||
else
|
||||
Platform->Ident = PP.getIdentifierInfo(
|
||||
AvailabilityAttr::canonicalizePlatformName(Ident->getName()));
|
||||
}
|
||||
|
||||
// Parse the ',' following the platform name.
|
||||
if (ExpectAndConsume(tok::comma)) {
|
||||
|
|
|
@ -21,8 +21,19 @@ __attribute__((availability(ios,unavailable)))
|
|||
#endif
|
||||
void f1(int); // expected-note {{'f1' has been explicitly marked unavailable here}}
|
||||
|
||||
#if __has_feature(attribute_availability_app_extension)
|
||||
__attribute__((availability(macOSApplicationExtension,unavailable)))
|
||||
#ifndef TVOS
|
||||
__attribute__((availability(iOSApplicationExtension,unavailable)))
|
||||
#else
|
||||
__attribute__((availability(tvOSApplicationExtension,unavailable)))
|
||||
#endif
|
||||
#endif
|
||||
void f2(int); // expected-note {{'f2' has been explicitly marked unavailable here}}
|
||||
|
||||
void test() {
|
||||
f0(1); // expected-error {{'f0' is unavailable: not available on}}
|
||||
f1(1); // expected-error {{'f1' is unavailable}}
|
||||
f2(2); // expected-error {{'f2' is unavailable: not available on}}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
void f0(int) __attribute__((availability(ios,introduced=2.0,deprecated=2.1))); // expected-note {{'f0' has been explicitly marked deprecated here}}
|
||||
void f1(int) __attribute__((availability(ios,introduced=2.1)));
|
||||
void f2(int) __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{'f2' has been explicitly marked deprecated here}}
|
||||
void f2(int) __attribute__((availability(iOS,introduced=2.0,deprecated=3.0))); // expected-note {{'f2' has been explicitly marked deprecated here}}
|
||||
void f3(int) __attribute__((availability(ios,introduced=3.0)));
|
||||
void f4(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(ios,introduced=2.0,deprecated=2.1,obsoleted=3.0))); // expected-note{{explicitly marked unavailable}}
|
||||
|
||||
void f5(int) __attribute__((availability(ios,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0))); // expected-note {{'f5' has been explicitly marked deprecated here}}
|
||||
void f6(int) __attribute__((availability(ios,deprecated=3.0)));
|
||||
void f6(int) __attribute__((availability(ios,introduced=2.0))); // expected-note {{'f6' has been explicitly marked deprecated here}}
|
||||
void f6(int) __attribute__((availability(iOS,introduced=2.0))); // expected-note {{'f6' has been explicitly marked deprecated here}}
|
||||
|
||||
void test() {
|
||||
f0(0); // expected-warning{{'f0' is deprecated: first deprecated in iOS 2.1}}
|
||||
|
|
|
@ -10,7 +10,7 @@ void f2(int) __attribute__((availability(macosx,introduced=10.4,deprecated=10.5)
|
|||
void f3(int) __attribute__((availability(macosx,introduced=10.6)));
|
||||
void f4(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(ios,introduced=2.0,deprecated=3.0))); // expected-note{{explicitly marked unavailable}}
|
||||
void f5(int) __attribute__((availability(ios,introduced=3.2), availability(macosx,unavailable))); // expected-note{{'f5' has been explicitly marked unavailable here}}
|
||||
void f6(int) __attribute__((availability(macosx,strict,introduced=10.6))); //expected-note{{'f6' has been explicitly marked unavailable here}}
|
||||
void f6(int) __attribute__((availability(macOS,strict,introduced=10.6))); //expected-note{{'f6' has been explicitly marked unavailable here}}
|
||||
|
||||
void test() {
|
||||
f0(0);
|
||||
|
@ -47,7 +47,7 @@ enum __attribute__((availability(macosx,introduced=8.0,deprecated=9.0))) {
|
|||
};
|
||||
|
||||
// Make sure the note is on the declaration with the actual availability attributes.
|
||||
struct __attribute__((availability(macosx,strict,introduced=10.9))) type_info // \
|
||||
struct __attribute__((availability(macOS,strict,introduced=10.9))) type_info // \
|
||||
expected-note{{'type_info' has been explicitly marked unavailable here}}
|
||||
{
|
||||
};
|
||||
|
|
|
@ -36,7 +36,7 @@ void f10(int);
|
|||
// Test tvOS specific attributes.
|
||||
void f0_tvos(int) __attribute__((availability(tvos,introduced=2.0,deprecated=2.1))); // expected-note {{'f0_tvos' has been explicitly marked deprecated here}}
|
||||
void f1_tvos(int) __attribute__((availability(tvos,introduced=2.1)));
|
||||
void f2_tvos(int) __attribute__((availability(tvos,introduced=2.0,deprecated=3.0))); // expected-note {{'f2_tvos' has been explicitly marked deprecated here}}
|
||||
void f2_tvos(int) __attribute__((availability(tvOS,introduced=2.0,deprecated=3.0))); // expected-note {{'f2_tvos' has been explicitly marked deprecated here}}
|
||||
void f3_tvos(int) __attribute__((availability(tvos,introduced=3.0)));
|
||||
void f4_tvos(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(tvos,introduced=2.0,deprecated=2.1,obsoleted=3.0))); // expected-note{{explicitly marked unavailable}}
|
||||
void f5_tvos(int) __attribute__((availability(tvos,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0)));
|
||||
|
@ -44,7 +44,7 @@ void f5_attr_reversed_tvos(int) __attribute__((availability(ios, deprecated=3.0)
|
|||
void f5b_tvos(int) __attribute__((availability(tvos,introduced=2.0))) __attribute__((availability(tvos,deprecated=3.0))); // expected-note {{'f5b_tvos' has been explicitly marked deprecated here}}
|
||||
void f5c_tvos(int) __attribute__((availability(ios,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0))); // expected-note {{'f5c_tvos' has been explicitly marked deprecated here}}
|
||||
void f6_tvos(int) __attribute__((availability(tvos,deprecated=3.0)));
|
||||
void f6_tvos(int) __attribute__((availability(tvos,introduced=2.0))); // expected-note {{'f6_tvos' has been explicitly marked deprecated here}}
|
||||
void f6_tvos(int) __attribute__((availability(tvOS,introduced=2.0))); // expected-note {{'f6_tvos' has been explicitly marked deprecated here}}
|
||||
|
||||
void test_tvos() {
|
||||
f0_tvos(0); // expected-warning{{'f0_tvos' is deprecated: first deprecated in tvOS 2.1}}
|
||||
|
|
|
@ -25,7 +25,7 @@ void test() {
|
|||
// Test watchOS specific attributes.
|
||||
void f0_watchos(int) __attribute__((availability(watchos,introduced=2.0,deprecated=2.1))); // expected-note {{'f0_watchos' has been explicitly marked deprecated here}}
|
||||
void f1_watchos(int) __attribute__((availability(watchos,introduced=2.1)));
|
||||
void f2_watchos(int) __attribute__((availability(watchos,introduced=2.0,deprecated=3.0))); // expected-note {{'f2_watchos' has been explicitly marked deprecated here}}
|
||||
void f2_watchos(int) __attribute__((availability(watchOS,introduced=2.0,deprecated=3.0))); // expected-note {{'f2_watchos' has been explicitly marked deprecated here}}
|
||||
void f3_watchos(int) __attribute__((availability(watchos,introduced=3.0)));
|
||||
void f4_watchos(int) __attribute__((availability(macosx,introduced=10.1,deprecated=10.3,obsoleted=10.5), availability(watchos,introduced=2.0,deprecated=2.1,obsoleted=3.0))); // expected-note{{explicitly marked unavailable}}
|
||||
void f5_watchos(int) __attribute__((availability(watchos,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0)));
|
||||
|
@ -33,7 +33,7 @@ void f5_attr_reversed_watchos(int) __attribute__((availability(ios, deprecated=3
|
|||
void f5b_watchos(int) __attribute__((availability(watchos,introduced=2.0))) __attribute__((availability(watchos,deprecated=3.0))); // expected-note {{'f5b_watchos' has been explicitly marked deprecated here}}
|
||||
void f5c_watchos(int) __attribute__((availability(ios,introduced=2.0))) __attribute__((availability(ios,deprecated=3.0))); // expected-note {{'f5c_watchos' has been explicitly marked deprecated here}}
|
||||
void f6_watchos(int) __attribute__((availability(watchos,deprecated=3.0)));
|
||||
void f6_watchos(int) __attribute__((availability(watchos,introduced=2.0))); // expected-note {{'f6_watchos' has been explicitly marked deprecated here}}
|
||||
void f6_watchos(int) __attribute__((availability(watchOS,introduced=2.0))); // expected-note {{'f6_watchos' has been explicitly marked deprecated here}}
|
||||
|
||||
void test_watchos() {
|
||||
f0_watchos(0); // expected-warning{{'f0_watchos' is deprecated: first deprecated in watchOS 2.1}}
|
||||
|
|
Loading…
Reference in New Issue