[cfe-commits] r158022 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/ARCMT/checking.m test/SemaObjC/attr-availability.m
Fariborz Jahanian
fjahanian at apple.com
Tue Jun 5 14:14:46 PDT 2012
Author: fjahanian
Date: Tue Jun 5 16:14:46 2012
New Revision: 158022
URL: http://llvm.org/viewvc/llvm-project?rev=158022&view=rev
Log:
objective-c: merge deprecated/unavailable attributes to
the overriding deprecated/unavailable method.
// rdar://11475360
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/ARCMT/checking.m
cfe/trunk/test/SemaObjC/attr-availability.m
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=158022&r1=158021&r2=158022&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Jun 5 16:14:46 2012
@@ -2240,12 +2240,9 @@
void Sema::mergeObjCMethodDecls(ObjCMethodDecl *newMethod,
ObjCMethodDecl *oldMethod) {
- // We don't want to merge unavailable and deprecated attributes
- // except from interface to implementation.
- bool mergeDeprecation = isa<ObjCImplDecl>(newMethod->getDeclContext());
- // Merge the attributes.
- mergeDeclAttributes(newMethod, oldMethod, mergeDeprecation);
+ // Merge the attributes, including deprecated/unavailable
+ mergeDeclAttributes(newMethod, oldMethod, /* mergeDeprecation */true);
// Merge attributes from the parameters.
ObjCMethodDecl::param_const_iterator oi = oldMethod->param_begin(),
Modified: cfe/trunk/test/ARCMT/checking.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/checking.m?rev=158022&r1=158021&r2=158022&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/checking.m (original)
+++ cfe/trunk/test/ARCMT/checking.m Tue Jun 5 16:14:46 2012
@@ -45,9 +45,9 @@
};
@interface A : NSObject
-- (id)retain;
-- (id)retainCount;
-- (id)autorelease;
+- (id)retain; // expected-note {{declaration has been explicitly marked unavailable here}}
+- (id)retainCount; // expected-note {{declaration has been explicitly marked unavailable here}}
+- (id)autorelease; // expected-note 2 {{declaration has been explicitly marked unavailable here}}
- (id)init;
- (oneway void)release;
- (void)dealloc;
@@ -79,7 +79,8 @@
[a.delegate release]; // expected-error {{it is not safe to remove 'retain' message on the result of a 'delegate' message; the object that was passed to 'setDelegate:' may not be properly retained}} \
// expected-error {{ARC forbids explicit message send}}
[unsafeS->unsafeObj retain]; // expected-error {{it is not safe to remove 'retain' message on an __unsafe_unretained type}} \
- // expected-error {{ARC forbids explicit message send}}
+ // expected-error {{ARC forbids explicit message send}} \
+ // expected-error {{'retain' is unavailable}}
id foo = [unsafeS->unsafeObj retain]; // no warning.
[global_foo retain]; // expected-error {{it is not safe to remove 'retain' message on a global variable}} \
// expected-error {{ARC forbids explicit message send}}
@@ -87,12 +88,15 @@
// expected-error {{ARC forbids explicit message send}}
[a dealloc];
[a retain];
- [a retainCount]; // expected-error {{ARC forbids explicit message send of 'retainCount'}}
+ [a retainCount]; // expected-error {{ARC forbids explicit message send of 'retainCount'}} \
+ // expected-error {{'retainCount' is unavailable}}
[a release];
[a autorelease]; // expected-error {{it is not safe to remove an unused 'autorelease' message; its receiver may be destroyed immediately}} \
- // expected-error {{ARC forbids explicit message send}}
+ // expected-error {{ARC forbids explicit message send}} \
+ // expected-error {{'autorelease' is unavailable}}
[a autorelease]; // expected-error {{it is not safe to remove an unused 'autorelease' message; its receiver may be destroyed immediately}} \
- // expected-error {{ARC forbids explicit message send}}
+ // expected-error {{ARC forbids explicit message send}} \
+ // expected-error {{'autorelease' is unavailable}}
a = 0;
CFStringRef cfstr;
Modified: cfe/trunk/test/SemaObjC/attr-availability.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/attr-availability.m?rev=158022&r1=158021&r2=158022&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/attr-availability.m (original)
+++ cfe/trunk/test/SemaObjC/attr-availability.m Tue Jun 5 16:14:46 2012
@@ -8,13 +8,14 @@
- (void)method __attribute__((availability(macosx,introduced=10.1,deprecated=10.2))); // expected-note {{method 'method' declared here}}
@end
+// rdar://11475360
@interface B : A
-- (void)method;
+- (void)method; // expected-note {{method 'method' declared here}}
@end
void f(A *a, B *b) {
[a method]; // expected-warning{{'method' is deprecated: first deprecated in Mac OS X 10.2}}
- [b method];
+ [b method]; // expected-warning {{'method' is deprecated: first deprecated in Mac OS X 10.2}}
[a proto_method]; // expected-warning{{'proto_method' is deprecated: first deprecated in Mac OS X 10.2}}
[b proto_method]; // expected-warning{{'proto_method' is deprecated: first deprecated in Mac OS X 10.2}}
}
More information about the cfe-commits
mailing list