[cfe-commits] r172586 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/SemaObjC/attr-availability.m

Douglas Gregor dgregor at apple.com
Tue Jan 15 16:54:48 PST 2013


Author: dgregor
Date: Tue Jan 15 18:54:48 2013
New Revision: 172586

URL: http://llvm.org/viewvc/llvm-project?rev=172586&view=rev
Log:
One can have an unavailable method overridden by an available method,
but not vice-versa. Fix bug introduced in r172567 and noticed by
Jordan, thanks!

Modified:
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
    cfe/trunk/test/SemaObjC/attr-availability.m

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=172586&r1=172585&r2=172586&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Jan 15 18:54:48 2013
@@ -2057,7 +2057,7 @@
           !versionsMatch(Deprecated, OldDeprecated, Override) ||
           !versionsMatch(Obsoleted, OldObsoleted, Override) ||
           !(OldIsUnavailable == IsUnavailable ||
-            (Override && OldIsUnavailable && !IsUnavailable))) {
+            (Override && !OldIsUnavailable && IsUnavailable))) {
         if (Override) {
           int Which = -1;
           VersionTuple FirstVersion;

Modified: cfe/trunk/test/SemaObjC/attr-availability.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/attr-availability.m?rev=172586&r1=172585&r2=172586&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/attr-availability.m (original)
+++ cfe/trunk/test/SemaObjC/attr-availability.m Tue Jan 15 18:54:48 2013
@@ -11,8 +11,8 @@
 - (void)overridden2 __attribute__((availability(macosx,introduced=10.3)));
 - (void)overridden3 __attribute__((availability(macosx,deprecated=10.3)));
 - (void)overridden4 __attribute__((availability(macosx,deprecated=10.3))); // expected-note{{overridden method is here}}
-- (void)overridden5 __attribute__((availability(macosx,unavailable))); // expected-note{{overridden method is here}}
-- (void)overridden6 __attribute__((availability(macosx,introduced=10.3)));
+- (void)overridden5 __attribute__((availability(macosx,unavailable)));
+- (void)overridden6 __attribute__((availability(macosx,introduced=10.3))); // expected-note{{overridden method is here}}
 @end
 
 // rdar://11475360
@@ -22,8 +22,8 @@
 - (void)overridden2 __attribute__((availability(macosx,introduced=10.2)));
 - (void)overridden3 __attribute__((availability(macosx,deprecated=10.4)));
 - (void)overridden4 __attribute__((availability(macosx,deprecated=10.2))); // expected-warning{{overriding method deprecated before overridden method on OS X (10.3 vs. 10.2)}}
-- (void)overridden5 __attribute__((availability(macosx,introduced=10.3))); // expected-warning{{overriding method cannot be unavailable on OS X when its overridden method is available}}
-- (void)overridden6 __attribute__((availability(macosx,unavailable)));
+- (void)overridden5 __attribute__((availability(macosx,introduced=10.3)));
+- (void)overridden6 __attribute__((availability(macosx,unavailable))); // expected-warning{{overriding method cannot be unavailable on OS X when its overridden method is available}}
 @end
 
 void f(A *a, B *b) {





More information about the cfe-commits mailing list