summaryrefslogtreecommitdiffstats
path: root/clang/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2007-12-17 21:03:50 +0000
committerFariborz Jahanian <fjahanian@apple.com>2007-12-17 21:03:50 +0000
commit24cb52c9b0cee08146da3c71ecaa73da361a5d33 (patch)
tree2a521429b84ab6b1bb74583cec9ec4410e93c832 /clang/Sema/SemaExpr.cpp
parent939526a930a3ce3c8afe86ef1238ffd7a74c142a (diff)
downloadbcm5719-llvm-24cb52c9b0cee08146da3c71ecaa73da361a5d33.tar.gz
bcm5719-llvm-24cb52c9b0cee08146da3c71ecaa73da361a5d33.zip
Patch to implemented objective-c's dynamic object pointer qualified with
the protocol list (id<P,...> types). llvm-svn: 45121
Diffstat (limited to 'clang/Sema/SemaExpr.cpp')
-rw-r--r--clang/Sema/SemaExpr.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/clang/Sema/SemaExpr.cpp b/clang/Sema/SemaExpr.cpp
index dae5325ac40..45d04705447 100644
--- a/clang/Sema/SemaExpr.cpp
+++ b/clang/Sema/SemaExpr.cpp
@@ -2292,13 +2292,16 @@ Sema::ExprResult Sema::ActOnInstanceMessage(
return true;
}
} else {
+ bool receiverIsQualId =
+ dyn_cast<ObjcQualifiedIdType>(RExpr->getType()) != 0;
// FIXME (snaroff): checking in this code from Patrick. Needs to be
// revisited. how do we get the ClassDecl from the receiver expression?
- while (receiverType->isPointerType()) {
- PointerType *pointerType =
- static_cast<PointerType*>(receiverType.getTypePtr());
- receiverType = pointerType->getPointeeType();
- }
+ if (!receiverIsQualId)
+ while (receiverType->isPointerType()) {
+ PointerType *pointerType =
+ static_cast<PointerType*>(receiverType.getTypePtr());
+ receiverType = pointerType->getPointeeType();
+ }
ObjcInterfaceDecl* ClassDecl;
if (ObjcQualifiedInterfaceType *QIT =
dyn_cast<ObjcQualifiedInterfaceType>(receiverType)) {
@@ -2312,6 +2315,23 @@ Sema::ExprResult Sema::ActOnInstanceMessage(
break;
}
}
+ if (!Method)
+ Diag(lbrac, diag::warn_method_not_found_in_protocol,
+ std::string("-"), Sel.getName(),
+ SourceRange(lbrac, rbrac));
+ }
+ else if (ObjcQualifiedIdType *QIT =
+ dyn_cast<ObjcQualifiedIdType>(receiverType)) {
+ // search protocols
+ for (unsigned i = 0; i < QIT->getNumProtocols(); i++) {
+ ObjcProtocolDecl *PDecl = QIT->getProtocols(i);
+ if (PDecl && (Method = PDecl->lookupInstanceMethod(Sel)))
+ break;
+ }
+ if (!Method)
+ Diag(lbrac, diag::warn_method_not_found_in_protocol,
+ std::string("-"), Sel.getName(),
+ SourceRange(lbrac, rbrac));
}
else {
assert(ObjcInterfaceType::classof(receiverType.getTypePtr()) &&
OpenPOWER on IntegriCloud