forked from OSchip/llvm-project
For @optional unimplemented methods do not issue the warning.
llvm-svn: 44872
This commit is contained in:
parent
5143d898c8
commit
3b5dca2533
|
@ -1532,7 +1532,8 @@ void Sema::CheckProtocolMethodDefs(ObjcProtocolDecl *PDecl,
|
||||||
// check unimplemented instance methods.
|
// check unimplemented instance methods.
|
||||||
ObjcMethodDecl** methods = PDecl->getInstanceMethods();
|
ObjcMethodDecl** methods = PDecl->getInstanceMethods();
|
||||||
for (int j = 0; j < PDecl->getNumInstanceMethods(); j++) {
|
for (int j = 0; j < PDecl->getNumInstanceMethods(); j++) {
|
||||||
if (!InsMap.count(methods[j]->getSelector())) {
|
if (!InsMap.count(methods[j]->getSelector()) &&
|
||||||
|
methods[j]->getImplementationControl() != ObjcMethodDecl::Optional) {
|
||||||
Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
|
Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
|
||||||
methods[j]->getSelector().getName());
|
methods[j]->getSelector().getName());
|
||||||
IncompleteImpl = true;
|
IncompleteImpl = true;
|
||||||
|
@ -1541,7 +1542,8 @@ void Sema::CheckProtocolMethodDefs(ObjcProtocolDecl *PDecl,
|
||||||
// check unimplemented class methods
|
// check unimplemented class methods
|
||||||
methods = PDecl->getClassMethods();
|
methods = PDecl->getClassMethods();
|
||||||
for (int j = 0; j < PDecl->getNumClassMethods(); j++)
|
for (int j = 0; j < PDecl->getNumClassMethods(); j++)
|
||||||
if (!ClsMap.count(methods[j]->getSelector())) {
|
if (!ClsMap.count(methods[j]->getSelector()) &&
|
||||||
|
methods[j]->getImplementationControl() != ObjcMethodDecl::Optional) {
|
||||||
Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
|
Diag(methods[j]->getLocation(), diag::warn_undef_method_impl,
|
||||||
methods[j]->getSelector().getName());
|
methods[j]->getSelector().getName());
|
||||||
IncompleteImpl = true;
|
IncompleteImpl = true;
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
// RUN: clang -verify %s
|
||||||
|
|
||||||
|
@protocol MyProto1
|
||||||
|
@optional
|
||||||
|
- (void) FOO;
|
||||||
|
@optional
|
||||||
|
- (void) FOO;
|
||||||
|
@optional
|
||||||
|
- (void) REQ;
|
||||||
|
@optional
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface MyProto2 <MyProto1>
|
||||||
|
- (void) FOO2;
|
||||||
|
- (void) FOO3;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation MyProto2
|
||||||
|
- (void) FOO2{}
|
||||||
|
- (void) FOO3{}
|
||||||
|
@end
|
Loading…
Reference in New Issue