summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprObjC.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-21 05:54:02 +0000
committerChris Lattner <sabre@nondot.org>2008-07-21 05:54:02 +0000
commit79f14789d803872a3ad7069c5046172050ce79fe (patch)
treee46108a3d93bacb4151facb9ac84902cc9c3c4d4 /clang/lib/Sema/SemaExprObjC.cpp
parent393f4ae0478db79dc895a2d9baf9a33fab1728a0 (diff)
downloadbcm5719-llvm-79f14789d803872a3ad7069c5046172050ce79fe.tar.gz
bcm5719-llvm-79f14789d803872a3ad7069c5046172050ce79fe.zip
tighten up some checks, don't allow sending a message to NSString****
llvm-svn: 53836
Diffstat (limited to 'clang/lib/Sema/SemaExprObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaExprObjC.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp
index 1067d1fb808..197bf372c4f 100644
--- a/clang/lib/Sema/SemaExprObjC.cpp
+++ b/clang/lib/Sema/SemaExprObjC.cpp
@@ -269,12 +269,13 @@ Sema::ExprResult Sema::ActOnInstanceMessage(
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 =
OpenPOWER on IntegriCloud