[cfe-commits] r89220 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/no-warn-qual-mismatch.m

Fariborz Jahanian fjahanian at apple.com
Wed Nov 18 10:56:09 PST 2009


Author: fjahanian
Date: Wed Nov 18 12:56:09 2009
New Revision: 89220

URL: http://llvm.org/viewvc/llvm-project?rev=89220&view=rev
Log:
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.

Added:
    cfe/trunk/test/SemaObjC/no-warn-qual-mismatch.m
Modified:
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=89220&r1=89219&r2=89220&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Wed Nov 18 12:56:09 2009
@@ -828,9 +828,10 @@
   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)

Added: cfe/trunk/test/SemaObjC/no-warn-qual-mismatch.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/no-warn-qual-mismatch.m?rev=89220&view=auto

==============================================================================
--- cfe/trunk/test/SemaObjC/no-warn-qual-mismatch.m (added)
+++ cfe/trunk/test/SemaObjC/no-warn-qual-mismatch.m Wed Nov 18 12:56:09 2009
@@ -0,0 +1,16 @@
+// RUN: clang-cc  -fsyntax-only -verify %s
+// radar 7211563
+
+ at interface X
+
++ (void)prototypeWithScalar:(int)aParameter;
++ (void)prototypeWithPointer:(void *)aParameter;
+
+ at end
+
+ at implementation X
+
++ (void)prototypeWithScalar:(const int)aParameter {}
++ (void)prototypeWithPointer:(void * const)aParameter {}
+
+ at end





More information about the cfe-commits mailing list