r179070 - Add test case calling a deprecated method from a subclass that reimplements that method gets a warning.

Ted Kremenek kremenek at apple.com
Mon Apr 8 16:39:32 PDT 2013


Author: kremenek
Date: Mon Apr  8 18:39:32 2013
New Revision: 179070

URL: http://llvm.org/viewvc/llvm-project?rev=179070&view=rev
Log:
Add test case calling a deprecated method from a subclass that reimplements that method gets a warning.

Test case from <rdar://problem/11627873>.

Modified:
    cfe/trunk/test/SemaObjC/attr-availability.m

Modified: cfe/trunk/test/SemaObjC/attr-availability.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/attr-availability.m?rev=179070&r1=179069&r2=179070&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/attr-availability.m (original)
+++ cfe/trunk/test/SemaObjC/attr-availability.m Mon Apr  8 18:39:32 2013
@@ -32,3 +32,31 @@ void f(A *a, B *b) {
   [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}}
 }
+
+// Test case for <rdar://problem/11627873>.  Warn about
+// using a deprecated method when that method is re-implemented in a
+// subclass where the redeclared method is not deprecated.
+ at interface C
+- (void) method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note {{method 'method' declared here}}
+ at end
+
+ at interface D : C
+- (void) method;
+ at end
+
+ at interface E : D
+- (void) method;
+ at end
+
+ at implementation D
+- (void) method {
+  [super method]; // expected-warning {{'method' is deprecated: first deprecated in OS X 10.2}}
+}
+ at end
+
+ at implementation E
+- (void) method {
+  [super method]; // no-warning
+}
+ at end
+





More information about the cfe-commits mailing list