r200342 - Objective-C. Fixes a bug where "new" family attribute
Fariborz Jahanian
fjahanian at apple.com
Tue Jan 28 14:46:30 PST 2014
Author: fjahanian
Date: Tue Jan 28 16:46:29 2014
New Revision: 200342
URL: http://llvm.org/viewvc/llvm-project?rev=200342&view=rev
Log:
Objective-C. Fixes a bug where "new" family attribute
was not being overridden in the category method implementation
resulting in bogus warning. // rdar://15919775
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/test/SemaObjC/dealloc.m
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=200342&r1=200341&r2=200342&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Tue Jan 28 16:46:29 2014
@@ -3165,7 +3165,8 @@ Decl *Sema::ActOnMethodDeclaration(
ObjCMethod->getLocation()));
}
if (isa<ObjCCategoryImplDecl>(ImpDecl)) {
- ObjCMethodFamily family = ObjCMethod->getMethodFamily();
+ ObjCMethodFamily family =
+ ObjCMethod->getSelector().getMethodFamily();
if (family == OMF_dealloc && IMD && IMD->isOverriding())
Diag(ObjCMethod->getLocation(), diag::warn_dealloc_in_category)
<< ObjCMethod->getDeclName();
Modified: cfe/trunk/test/SemaObjC/dealloc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/dealloc.m?rev=200342&r1=200341&r2=200342&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/dealloc.m (original)
+++ cfe/trunk/test/SemaObjC/dealloc.m Tue Jan 28 16:46:29 2014
@@ -39,3 +39,17 @@
- (void)dealloc { // expected-warning {{-dealloc is being overridden in a category}}
}
@end
+
+// rdar://15919775
+ at interface NSObject @end
+ at interface NSError:NSObject
+ at end
+
+ at interface NSError(CAT)
+- (NSError *)MCCopyAsPrimaryError __attribute__((objc_method_family(new)));
+ at end
+ at implementation NSError(CAT)
+- (NSError *)MCCopyAsPrimaryError {
+ return 0;
+}
+ at end
More information about the cfe-commits
mailing list