[cfe-commits] r58049 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/CodeGenObjC/2008-10-23-invalid-icmp.m

Daniel Dunbar daniel at zuster.org
Thu Oct 23 16:30:52 PDT 2008


Author: ddunbar
Date: Thu Oct 23 18:30:52 2008
New Revision: 58049

URL: http://llvm.org/viewvc/llvm-project?rev=58049&view=rev
Log:
Fix regression in comparison of qualified id; == operator was being
created with LHS and RHS whose types didn't match.

Added:
    cfe/trunk/test/CodeGenObjC/2008-10-23-invalid-icmp.m
Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Oct 23 18:30:52 2008
@@ -2153,6 +2153,7 @@
       Diag(loc, diag::ext_typecheck_comparison_of_distinct_pointers,
            lType.getAsString(), rType.getAsString(),
            lex->getSourceRange(), rex->getSourceRange());
+      ImpCastExprToType(rex, lType);
       return Context.IntTy;
     }
     if (ObjCQualifiedIdTypesAreCompatible(lType, rType, true)) {
@@ -2161,8 +2162,9 @@
     } else {
       if ((lType->isObjCQualifiedIdType() && rType->isObjCQualifiedIdType())) {
         Diag(loc, diag::warn_incompatible_qualified_id_operands, 
-             lex->getType().getAsString(), rex->getType().getAsString(),
+             lType.getAsString(), rType.getAsString(),
              lex->getSourceRange(), rex->getSourceRange());
+        ImpCastExprToType(rex, lType);
         return Context.IntTy;
       }
     }

Added: cfe/trunk/test/CodeGenObjC/2008-10-23-invalid-icmp.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/2008-10-23-invalid-icmp.m?rev=58049&view=auto

==============================================================================
--- cfe/trunk/test/CodeGenObjC/2008-10-23-invalid-icmp.m (added)
+++ cfe/trunk/test/CodeGenObjC/2008-10-23-invalid-icmp.m Thu Oct 23 18:30:52 2008
@@ -0,0 +1,7 @@
+// RUN: clang -emit-llvm -o %t %s
+
+ at protocol P @end
+
+int f0(id<P> d) {
+  return (d != ((void*) 0));
+}





More information about the cfe-commits mailing list