Don't warn if objc method param types in declaration and

implementation mismatch in their qualifiers only.
This will match similar behavior in c/c++ and
fixes radar 7211653.

llvm-svn: 89220
This commit is contained in:
Fariborz Jahanian 2009-11-18 18:56:09 +00:00
parent 643818bdd8
commit 41e803d8c7
2 changed files with 20 additions and 3 deletions

View File

@ -828,9 +828,10 @@ void Sema::WarnConflictingTypedMethods(ObjCMethodDecl *ImpMethodDecl,
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()) ||
Context.QualifiedIdConformsQualifiedId((*IF)->getType(),
(*IM)->getType()))
QualType ParmDeclTy = (*IF)->getType().getUnqualifiedType();
QualType ParmImpTy = (*IM)->getType().getUnqualifiedType();
if (Context.typesAreCompatible(ParmDeclTy, ParmImpTy) ||
Context.QualifiedIdConformsQualifiedId(ParmDeclTy, ParmImpTy))
continue;
Diag((*IM)->getLocation(), diag::warn_conflicting_param_types)

View File

@ -0,0 +1,16 @@
// RUN: clang-cc -fsyntax-only -verify %s
// radar 7211563
@interface X
+ (void)prototypeWithScalar:(int)aParameter;
+ (void)prototypeWithPointer:(void *)aParameter;
@end
@implementation X
+ (void)prototypeWithScalar:(const int)aParameter {}
+ (void)prototypeWithPointer:(void * const)aParameter {}
@end