summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2013-04-06 00:34:27 +0000
committerTed Kremenek <kremenek@apple.com>2013-04-06 00:34:27 +0000
commitb54457242c1cb772cb40645b4cd553ce38aeb2dc (patch)
tree66b9751955f33652e59dbf44809412d97c3def6c /clang/lib/Sema/SemaDecl.cpp
parentf1ff3bb6806159d802948596612975cf6b730178 (diff)
downloadbcm5719-llvm-b54457242c1cb772cb40645b4cd553ce38aeb2dc.tar.gz
bcm5719-llvm-b54457242c1cb772cb40645b4cd553ce38aeb2dc.zip
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> llvm-svn: 178937
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index e9116bc91a5..84d992c8788 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2769,7 +2769,10 @@ void Sema::mergeObjCMethodDecls(ObjCMethodDecl *newMethod,
ObjCMethodDecl *oldMethod) {
// Merge the attributes, including deprecated/unavailable
- mergeDeclAttributes(newMethod, oldMethod, AMK_Override);
+ AvailabilityMergeKind MergeKind =
+ isa<ObjCImplDecl>(newMethod->getDeclContext()) ? AMK_Redeclaration
+ : AMK_Override;
+ mergeDeclAttributes(newMethod, oldMethod, MergeKind);
// Merge attributes from the parameters.
ObjCMethodDecl::param_const_iterator oi = oldMethod->param_begin(),
OpenPOWER on IntegriCloud