tighten up some checks, don't allow sending a message to NSString****

llvm-svn: 53836
This commit is contained in:
Chris Lattner 2008-07-21 05:54:02 +00:00
parent 393f4ae047
commit 79f14789d8
1 changed files with 6 additions and 5 deletions

View File

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