]> granicus.if.org Git - clang/commitdiff
Fix implicit ios -> watchOS availability version mapping for
authorAlex Lorenz <arphaman@gmail.com>
Wed, 20 Mar 2019 20:02:00 +0000 (20:02 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Wed, 20 Mar 2019 20:02:00 +0000 (20:02 +0000)
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

lib/Sema/SemaDeclAttr.cpp
test/Sema/attr-availability-watchos.c

index f16b6e9897beb4311c783ce76b77a6f8c765b69c..e8a77b3dc28332616532fec47f14306c4e2d5154 100644 (file)
@@ -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);
index 866efac6a04faecb503600956b6b4cc04f0a4bae..dbcf2c24c607200973f593cc1cad150fca36c859 100644 (file)
@@ -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}}
+}