diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-11-18 18:56:09 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-11-18 18:56:09 +0000 |
commit | 3393f8157a11627fd52889fbc3fd279f6704d5d4 (patch) | |
tree | 8b3f9fed47d85de6ad37b0762f0adbdf0b33987e | |
parent | 19df37c55437bf3b8de85f93e55d05a57e900dff (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89220 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDeclObjC.cpp | 7 | ||||
-rw-r--r-- | test/SemaObjC/no-warn-qual-mismatch.m | 16 |
2 files changed, 20 insertions, 3 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 0c5569caff..7da37affdc 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -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) diff --git a/test/SemaObjC/no-warn-qual-mismatch.m b/test/SemaObjC/no-warn-qual-mismatch.m new file mode 100644 index 0000000000..3bd4dba545 --- /dev/null +++ b/test/SemaObjC/no-warn-qual-mismatch.m @@ -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 |