diff options
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 52b6db59f3..6048901e7a 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -763,25 +763,28 @@ void Sema::WarnUndefinedMethod(SourceLocation ImpLoc, ObjCMethodDecl *method, void Sema::WarnConflictingTypedMethods(ObjCMethodDecl *ImpMethodDecl, ObjCMethodDecl *IntfMethodDecl) { - bool err = false; if (!Context.typesAreCompatible(IntfMethodDecl->getResultType(), - ImpMethodDecl->getResultType())) - err = true; - else - for (ObjCMethodDecl::param_iterator IM=ImpMethodDecl->param_begin(), - IF = IntfMethodDecl->param_begin(), EM = ImpMethodDecl->param_end(); - IM != EM; ++IM, ++IF) { - if (!Context.typesAreCompatible((*IF)->getType(), (*IM)->getType())) { - err = true; - break; - } - } - - if (err) { - Diag(ImpMethodDecl->getLocation(), diag::warn_conflicting_types) - << ImpMethodDecl->getDeclName(); + ImpMethodDecl->getResultType())) { + Diag(ImpMethodDecl->getLocation(), diag::warn_conflicting_ret_types) + << ImpMethodDecl->getDeclName() << IntfMethodDecl->getResultType() + << ImpMethodDecl->getResultType(); Diag(IntfMethodDecl->getLocation(), diag::note_previous_definition); } + + for (ObjCMethodDecl::param_iterator IM = ImpMethodDecl->param_begin(), + IF = IntfMethodDecl->param_begin(), EM = ImpMethodDecl->param_end(); + IM != EM; ++IM, ++IF) { + if (Context.typesAreCompatible((*IF)->getType(), (*IM)->getType())) + continue; + + Diag((*IM)->getLocation(), diag::warn_conflicting_param_types) + << ImpMethodDecl->getDeclName() << (*IF)->getType() + << (*IM)->getType(); + SourceLocation Loc = (*IF)->getLocation(); + // FIXME + if (Loc == SourceLocation()) Loc = IntfMethodDecl->getLocation(); + Diag(Loc, diag::note_previous_definition); + } } /// isPropertyReadonly - Return true if property is readonly, by searching |