From: Erik Pilkington Date: Mon, 1 Aug 2016 20:19:49 +0000 (+0000) Subject: [ObjC Availability] Fix partial-availability false positive introduced in r277058 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=033d0b704e48808fa7453d324625da9df1800eeb;p=clang [ObjC Availability] Fix partial-availability false positive introduced in r277058 Thanks to Nico Weber for pointing this out! Differential revision: https://reviews.llvm.org/D23024 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@277378 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 287632382d..edecc06e49 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -6505,5 +6505,5 @@ VersionTuple Sema::getVersionForDecl(const Decl *D) const { DeclVersion = AA->getIntroduced(); } - return DeclVersion; + return std::max(DeclVersion, Context.getTargetInfo().getPlatformMinVersion()); } diff --git a/test/SemaObjC/attr-availability.m b/test/SemaObjC/attr-availability.m index 1be949086d..dfd544ba02 100644 --- a/test/SemaObjC/attr-availability.m +++ b/test/SemaObjC/attr-availability.m @@ -297,6 +297,7 @@ __attribute__((objc_root_class)) #if defined(WARN_PARTIAL) +int fn_10_5() __attribute__((availability(macosx, introduced=10.5))); int fn_10_7() __attribute__((availability(macosx, introduced=10.7))); // expected-note{{marked partial here}} int fn_10_8() __attribute__((availability(macosx, introduced=10.8))) { // expected-note{{marked partial here}} return fn_10_7(); @@ -324,4 +325,8 @@ __attribute__((availability(macosx, introduced=10.7))) -(void)method4 { fn_10_8(); } @end +int old_func() __attribute__((availability(macos, introduced=10.4))) { + fn_10_5(); +} + #endif