forked from OSchip/llvm-project
Patch to remove bogus warning in case of @dynamic
property in a category and to issue diagnostics for mismatch method in some other cases. llvm-svn: 61336
This commit is contained in:
parent
04253537dc
commit
ed4c443193
|
@ -737,13 +737,16 @@ void Sema::ImplMethodsVsClassMethods(ObjCImplementationDecl* IMPDecl,
|
||||||
E = IDecl->instmeth_end(); I != E; ++I)
|
E = IDecl->instmeth_end(); I != E; ++I)
|
||||||
if (!(*I)->isSynthesized() && !InsMap.count((*I)->getSelector()))
|
if (!(*I)->isSynthesized() && !InsMap.count((*I)->getSelector()))
|
||||||
WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl);
|
WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl);
|
||||||
else if (!(*I)->isSynthesized()){
|
else {
|
||||||
ObjCMethodDecl *ImpMethodDecl =
|
ObjCMethodDecl *ImpMethodDecl =
|
||||||
IMPDecl->getInstanceMethod((*I)->getSelector());
|
IMPDecl->getInstanceMethod((*I)->getSelector());
|
||||||
ObjCMethodDecl *IntfMethodDecl =
|
ObjCMethodDecl *IntfMethodDecl =
|
||||||
IDecl->getInstanceMethod((*I)->getSelector());
|
IDecl->getInstanceMethod((*I)->getSelector());
|
||||||
WarnConflictingTypedMethods(ImpMethodDecl, IntfMethodDecl);
|
assert(IntfMethodDecl &&
|
||||||
|
"IntfMethodDecl is null in ImplMethodsVsClassMethods");
|
||||||
|
// ImpMethodDecl may be null as in a @dynamic property.
|
||||||
|
if (ImpMethodDecl)
|
||||||
|
WarnConflictingTypedMethods(ImpMethodDecl, IntfMethodDecl);
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::DenseSet<Selector> ClsMap;
|
llvm::DenseSet<Selector> ClsMap;
|
||||||
|
@ -790,14 +793,18 @@ void Sema::ImplCategoryMethodsVsIntfMethods(ObjCCategoryImplDecl *CatImplDecl,
|
||||||
bool IncompleteImpl = false;
|
bool IncompleteImpl = false;
|
||||||
for (ObjCCategoryDecl::instmeth_iterator I = CatClassDecl->instmeth_begin(),
|
for (ObjCCategoryDecl::instmeth_iterator I = CatClassDecl->instmeth_begin(),
|
||||||
E = CatClassDecl->instmeth_end(); I != E; ++I)
|
E = CatClassDecl->instmeth_end(); I != E; ++I)
|
||||||
if (!InsMap.count((*I)->getSelector()))
|
if (!(*I)->isSynthesized() && !InsMap.count((*I)->getSelector()))
|
||||||
WarnUndefinedMethod(CatImplDecl->getLocation(), *I, IncompleteImpl);
|
WarnUndefinedMethod(CatImplDecl->getLocation(), *I, IncompleteImpl);
|
||||||
else {
|
else {
|
||||||
ObjCMethodDecl *ImpMethodDecl =
|
ObjCMethodDecl *ImpMethodDecl =
|
||||||
CatImplDecl->getInstanceMethod((*I)->getSelector());
|
CatImplDecl->getInstanceMethod((*I)->getSelector());
|
||||||
ObjCMethodDecl *IntfMethodDecl =
|
ObjCMethodDecl *IntfMethodDecl =
|
||||||
CatClassDecl->getInstanceMethod((*I)->getSelector());
|
CatClassDecl->getInstanceMethod((*I)->getSelector());
|
||||||
WarnConflictingTypedMethods(ImpMethodDecl, IntfMethodDecl);
|
assert(IntfMethodDecl &&
|
||||||
|
"IntfMethodDecl is null in ImplCategoryMethodsVsIntfMethods");
|
||||||
|
// ImpMethodDecl may be null as in a @dynamic property.
|
||||||
|
if (ImpMethodDecl)
|
||||||
|
WarnConflictingTypedMethods(ImpMethodDecl, IntfMethodDecl);
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::DenseSet<Selector> ClsMap;
|
llvm::DenseSet<Selector> ClsMap;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
@synthesize name; // OK! property with same name as an accessible ivar of same name
|
@synthesize name; // OK! property with same name as an accessible ivar of same name
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation I(CAT) // expected-warning {{incomplete implementation}}, expected-warning {{method definition for 'd1' not found}}, // expected-warning {{method definition for 'setD1:' not found}}
|
@implementation I(CAT)
|
||||||
@synthesize d1; // expected-error {{@synthesize not allowed in a category's implementation}}
|
@synthesize d1; // expected-error {{@synthesize not allowed in a category's implementation}}
|
||||||
@dynamic bad; // expected-error {{property implementation must have its declaration in the category 'CAT'}}
|
@dynamic bad; // expected-error {{property implementation must have its declaration in the category 'CAT'}}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -18,4 +18,14 @@
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@interface A
|
||||||
|
@property(assign) int categoryProperty;
|
||||||
|
@end
|
||||||
|
|
||||||
|
// Don't issue warning on unimplemented setter/getter
|
||||||
|
// because property is @dynamic.
|
||||||
|
@implementation A
|
||||||
|
@dynamic categoryProperty;
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue