[cfe-commits] r51809 - in /cfe/trunk: lib/Sema/SemaExprObjC.cpp test/Sema/const-id.m

Steve Naroff snaroff at apple.com
Fri May 30 19:19:16 PDT 2008


Author: snaroff
Date: Fri May 30 21:19:15 2008
New Revision: 51809

URL: http://llvm.org/viewvc/llvm-project?rev=51809&view=rev
Log:
Fix <rdar://problem/5965704> clang: bad receiver type 'id const'

Added:
    cfe/trunk/test/Sema/const-id.m
Modified:
    cfe/trunk/lib/Sema/SemaExprObjC.cpp

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Fri May 30 21:19:15 2008
@@ -199,11 +199,12 @@
   
   Expr **ArgExprs = reinterpret_cast<Expr **>(Args);
   Expr *RExpr = static_cast<Expr *>(receiver);
-  QualType receiverType = RExpr->getType().getCanonicalType();
+  QualType receiverType;
   QualType returnType;
   ObjCMethodDecl *Method = 0;
+
+  receiverType = RExpr->getType().getCanonicalType().getUnqualifiedType();
   
-  // FIXME: This code is not stripping off type qualifiers! Should it?
   if (receiverType == Context.getObjCIdType().getCanonicalType() ||
       receiverType == Context.getObjCClassType().getCanonicalType()) {
     Method = InstanceMethodPool[Sel].Method;

Added: cfe/trunk/test/Sema/const-id.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/const-id.m?rev=51809&view=auto

==============================================================================
--- cfe/trunk/test/Sema/const-id.m (added)
+++ cfe/trunk/test/Sema/const-id.m Fri May 30 21:19:15 2008
@@ -0,0 +1,8 @@
+// RUN: clang %s -verify -fsyntax-only
+
+int main() {
+    const id foo;
+    [foo bar];  // expected-warning {{method '-bar' not found (return type defaults to 'id')}}
+    return 0;
+}
+





More information about the cfe-commits mailing list