Rework how ObjC method inherit deprecated/availability.
New rule:
- Method decls in @implementation are considered "redeclarations"
and inherit deprecated/availability from the @interface.
- All other cases are consider overrides, which do not inherit
deprecated/availability. For example:
(a) @interface redeclares a method in an adopted protocol.
(b) A subclass redeclares a method in a superclass.
(c) A protocol redeclares a method from another protocol it adopts.
The idea is that API authors should have the ability to easily
move availability/deprecated up and down a class/protocol hierarchy.
A redeclaration means that the availability/deprecation is a blank
slate.
Fixes <rdar://problem/13574571>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178937 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjC/attr-availability.m b/test/SemaObjC/attr-availability.m
index bf7ef19..5fe2b62 100644
--- a/test/SemaObjC/attr-availability.m
+++ b/test/SemaObjC/attr-availability.m
@@ -17,7 +17,7 @@
// rdar://11475360
@interface B : A
-- (void)method; // expected-note {{method 'method' declared here}}
+- (void)method; // NOTE: we expect 'method' to *not* inherit availability.
- (void)overridden __attribute__((availability(macosx,introduced=10.4))); // expected-warning{{overriding method introduced after overridden method on OS X (10.4 vs. 10.3)}}
- (void)overridden2 __attribute__((availability(macosx,introduced=10.2)));
- (void)overridden3 __attribute__((availability(macosx,deprecated=10.4)));
@@ -28,7 +28,7 @@
void f(A *a, B *b) {
[a method]; // expected-warning{{'method' is deprecated: first deprecated in OS X 10.2}}
- [b method]; // expected-warning {{'method' is deprecated: first deprecated in OS X 10.2}}
+ [b method]; // no-warning
[a proto_method]; // expected-warning{{'proto_method' is deprecated: first deprecated in OS X 10.2}}
[b proto_method]; // expected-warning{{'proto_method' is deprecated: first deprecated in OS X 10.2}}
}