[cfe-commits] r53836 - /cfe/trunk/lib/Sema/SemaExprObjC.cpp

Chris Lattner sabre at nondot.org
Sun Jul 20 22:54:02 PDT 2008


Author: lattner
Date: Mon Jul 21 00:54:02 2008
New Revision: 53836

URL: http://llvm.org/viewvc/llvm-project?rev=53836&view=rev
Log:
tighten up some checks, don't allow sending a message to NSString****

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=53836&r1=53835&r2=53836&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Mon Jul 21 00:54:02 2008
@@ -269,12 +269,13 @@
           return true;
     }
   } else {
-    bool receiverIsQualId = isa<ObjCQualifiedIdType>(receiverType);
-    // FIXME (snaroff): checking in this code from Patrick. Needs to be
-    // revisited. how do we get the ClassDecl from the receiver expression?
-    if (!receiverIsQualId)
-      while (const PointerType *PTy = receiverType->getAsPointerType())
+    // We allow sending a message to a qualified ID ("id<foo>") to an interface
+    // directly ("[NSNumber foo]") and to a pointer to an interface (an object).
+    if (!isa<ObjCQualifiedIdType>(receiverType) &&
+        !isa<ObjCInterfaceType>(receiverType))
+      if (const PointerType *PTy = receiverType->getAsPointerType())
         receiverType = PTy->getPointeeType();
+      // else error, invalid receiver.
     
     ObjCInterfaceDecl* ClassDecl = 0;
     if (ObjCQualifiedIdType *QIT = 





More information about the cfe-commits mailing list