diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-31 18:23:33 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-03-31 18:23:33 +0000 |
commit | 521468391c0abbbfcf6b257442630c70314b8576 (patch) | |
tree | 7a4439826b2845a4f5e33d8c8982dffe42d70069 /lib/Sema/SemaDeclObjC.cpp | |
parent | db2eb5abf4c082d1f0c5c45e39d8cd0300f81e38 (diff) |
Patch implements gcc's -Wno-protocol option to suppress warning
on unimplemented methods in protocols adopted by a class.
(radar 7056600).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 1334e063f7..9bc0846901 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -719,12 +719,12 @@ void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, } void Sema::WarnUndefinedMethod(SourceLocation ImpLoc, ObjCMethodDecl *method, - bool &IncompleteImpl) { + bool &IncompleteImpl, unsigned DiagID) { if (!IncompleteImpl) { Diag(ImpLoc, diag::warn_incomplete_impl); IncompleteImpl = true; } - Diag(method->getLocation(), diag::note_undef_method_impl) + Diag(method->getLocation(), DiagID) << method->getDeclName(); } @@ -815,9 +815,12 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc, ObjCMethodDecl *MethodInClass = IDecl->lookupInstanceMethod(method->getSelector()); if (!MethodInClass || !MethodInClass->isSynthesized()) { - WarnUndefinedMethod(ImpLoc, method, IncompleteImpl); - Diag(CDecl->getLocation(), diag::note_required_for_protocol_at) << - PDecl->getDeclName(); + unsigned DIAG = diag::warn_unimplemented_protocol_method; + if (Diags.getDiagnosticLevel(DIAG) != Diagnostic::Ignored) { + WarnUndefinedMethod(ImpLoc, method, IncompleteImpl, DIAG); + Diag(CDecl->getLocation(), diag::note_required_for_protocol_at) + << PDecl->getDeclName(); + } } } } @@ -829,9 +832,12 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc, if (method->getImplementationControl() != ObjCMethodDecl::Optional && !ClsMap.count(method->getSelector()) && (!Super || !Super->lookupClassMethod(method->getSelector()))) { - WarnUndefinedMethod(ImpLoc, method, IncompleteImpl); - Diag(IDecl->getLocation(), diag::note_required_for_protocol_at) << - PDecl->getDeclName(); + unsigned DIAG = diag::warn_unimplemented_protocol_method; + if (Diags.getDiagnosticLevel(DIAG) != Diagnostic::Ignored) { + WarnUndefinedMethod(ImpLoc, method, IncompleteImpl, DIAG); + Diag(IDecl->getLocation(), diag::note_required_for_protocol_at) << + PDecl->getDeclName(); + } } } // Check on this protocols's referenced protocols, recursively. @@ -861,7 +867,8 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet<Selector> &InsMap, if (!(*I)->isSynthesized() && !InsMap.count((*I)->getSelector())) { if (ImmediateClass) - WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl); + WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl, + diag::note_undef_method_impl); continue; } else { ObjCMethodDecl *ImpMethodDecl = @@ -885,7 +892,8 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet<Selector> &InsMap, ClsMapSeen.insert((*I)->getSelector()); if (!ClsMap.count((*I)->getSelector())) { if (ImmediateClass) - WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl); + WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl, + diag::note_undef_method_impl); } else { ObjCMethodDecl *ImpMethodDecl = IMPDecl->getClassMethod((*I)->getSelector()); |