From: Alex Lorenz Date: Wed, 20 Mar 2019 20:02:00 +0000 (+0000) Subject: Fix implicit ios -> watchOS availability version mapping for X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4f7e7882e9972ec567a0529a38737cb83324c91b;p=clang Fix implicit ios -> watchOS availability version mapping for versions that have the major number only rdar://48018651 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@356605 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index f16b6e9897..e8a77b3dc2 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -2508,6 +2508,7 @@ static void handleAvailabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { else return VersionTuple(NewMajor, Version.getMinor().getValue()); } + return VersionTuple(NewMajor); } return VersionTuple(2, 0); diff --git a/test/Sema/attr-availability-watchos.c b/test/Sema/attr-availability-watchos.c index 866efac6a0..dbcf2c24c6 100644 --- a/test/Sema/attr-availability-watchos.c +++ b/test/Sema/attr-availability-watchos.c @@ -52,3 +52,9 @@ void test_watchos() { f5c_watchos(0); // expected-warning {{'f5c_watchos' is deprecated: first deprecated in watchOS 2.0}} f6_watchos(0); // expected-warning {{'f6_watchos' is deprecated: first deprecated in watchOS 3.0}} } + +void deprecatedAfterIntroduced() __attribute__((availability(ios,introduced=9.3,deprecated=10))); // expected-note {{here}} + +void test_ios_correctly_map_to_watchos() { + deprecatedAfterIntroduced(); // expected-warning {{'deprecatedAfterIntroduced' is deprecated: first deprecated in watchOS 3}} +}