diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-27 19:02:17 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-27 19:02:17 +0000 |
commit | 8822f7cda557ffa755c16b5c978dada23c37d6be (patch) | |
tree | 5a38c2d0f3f437108863265133b76303785c072e /lib/Sema/SemaDeclObjC.cpp | |
parent | 9a4d77f56313cae5693c8cbd64fb13086a1b43d8 (diff) |
Improve diagnostics on incomplete implementation
of objc classes; including which methods
need be implemented and where they come from.
WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99724 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 1feeffdfe5..79a664f2e1 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -724,7 +724,8 @@ void Sema::WarnUndefinedMethod(SourceLocation ImpLoc, ObjCMethodDecl *method, Diag(ImpLoc, diag::warn_incomplete_impl); IncompleteImpl = true; } - Diag(ImpLoc, diag::warn_undef_method_impl) << method->getDeclName(); + Diag(method->getLocation(), diag::note_undef_method_impl) + << method->getDeclName(); } void Sema::WarnConflictingTypedMethods(ObjCMethodDecl *ImpMethodDecl, @@ -806,8 +807,11 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc, // uses the protocol. ObjCMethodDecl *MethodInClass = IDecl->lookupInstanceMethod(method->getSelector()); - if (!MethodInClass || !MethodInClass->isSynthesized()) + if (!MethodInClass || !MethodInClass->isSynthesized()) { WarnUndefinedMethod(ImpLoc, method, IncompleteImpl); + Diag(IDecl->getLocation(), diag::note_required_for_protocol_at) << + PDecl->getDeclName(); + } } } // check unimplemented class methods @@ -817,8 +821,11 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc, ObjCMethodDecl *method = *I; if (method->getImplementationControl() != ObjCMethodDecl::Optional && !ClsMap.count(method->getSelector()) && - (!Super || !Super->lookupClassMethod(method->getSelector()))) + (!Super || !Super->lookupClassMethod(method->getSelector()))) { WarnUndefinedMethod(ImpLoc, method, IncompleteImpl); + Diag(IDecl->getLocation(), diag::note_required_for_protocol_at) << + PDecl->getDeclName(); + } } // Check on this protocols's referenced protocols, recursively. for (ObjCProtocolDecl::protocol_iterator PI = PDecl->protocol_begin(), |