Objective-C. Fixes a bug where "new" family attribute

was not being overridden in the category method implementation
resulting in bogus warning. // rdar://15919775

llvm-svn: 200342
This commit is contained in:
Fariborz Jahanian 2014-01-28 22:46:29 +00:00
parent 7523743075
commit f40ef45c9d
2 changed files with 16 additions and 1 deletions

View File

@ -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();

View File

@ -39,3 +39,17 @@
- (void)dealloc { // expected-warning {{-dealloc is being overridden in a category}}
}
@end
// rdar://15919775
@interface NSObject @end
@interface NSError:NSObject
@end
@interface NSError(CAT)
- (NSError *)MCCopyAsPrimaryError __attribute__((objc_method_family(new)));
@end
@implementation NSError(CAT)
- (NSError *)MCCopyAsPrimaryError {
return 0;
}
@end