[cfe-commits] r65317 - /cfe/trunk/lib/Sema/SemaExprObjC.cpp
Steve Naroff
snaroff at apple.com
Mon Feb 23 07:40:49 PST 2009
Author: snaroff
Date: Mon Feb 23 09:40:48 2009
New Revision: 65317
URL: http://llvm.org/viewvc/llvm-project?rev=65317&view=rev
Log:
Remove isSuperExpr(), which ignores any casts on 'super'.
I don't think casting super makes any sense (since it won't effect method lookup).
Will discuss with other offline and decide what to do.
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=65317&r1=65316&r2=65317&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Mon Feb 23 09:40:48 2009
@@ -309,22 +309,6 @@
lbrac, rbrac, ArgExprs, NumArgs);
}
-// This routine makes sure we handle the following:
-//
-// [(Object <Func> *)super class_func0];
-// [(id <Func>)super class_func0];
-//
-static bool isSuperExpr(Stmt *S) {
- for (Stmt::child_iterator CI = S->child_begin(), E = S->child_end();
- CI != E; ++CI) {
- if (*CI)
- return isSuperExpr(*CI);
- }
- if (isa<ObjCSuperExpr>(S))
- return true;
- return false;
-}
-
// ActOnInstanceMessage - used for both unary and keyword messages.
// ArgExprs is optional - if it is present, the number of expressions
// is obtained from Sel.getNumArgs().
@@ -343,7 +327,7 @@
Context.getCanonicalType(RExpr->getType()).getUnqualifiedType();
// Handle messages to 'super'.
- if (isSuperExpr(RExpr)) {
+ if (isa<ObjCSuperExpr>(RExpr)) {
ObjCMethodDecl *Method = 0;
if (ObjCMethodDecl *CurMeth = getCurMethodDecl()) {
// If we have an interface in scope, check 'super' methods.
@@ -428,11 +412,11 @@
if (PDecl && (Method = PDecl->lookupClassMethod(Sel)))
break;
}
- } else if (const ObjCInterfaceType *OCIReceiver =
+ } else if (const ObjCInterfaceType *OCIType =
ReceiverCType->getAsPointerToObjCInterfaceType()) {
// We allow sending a message to a pointer to an interface (an object).
- ClassDecl = OCIReceiver->getDecl();
+ ClassDecl = OCIType->getDecl();
// FIXME: consider using LookupInstanceMethodInGlobalPool, since it will be
// faster than the following method (which can do *many* linear searches).
// The idea is to add class info to InstanceMethodPool.
@@ -440,8 +424,8 @@
if (!Method) {
// Search protocol qualifiers.
- for (ObjCQualifiedIdType::qual_iterator QI = OCIReceiver->qual_begin(),
- E = OCIReceiver->qual_end(); QI != E; ++QI) {
+ for (ObjCQualifiedInterfaceType::qual_iterator QI = OCIType->qual_begin(),
+ E = OCIType->qual_end(); QI != E; ++QI) {
if ((Method = (*QI)->lookupInstanceMethod(Sel)))
break;
}
@@ -455,7 +439,7 @@
// If we still haven't found a method, look in the global pool. This
// behavior isn't very desirable, however we need it for GCC
// compatibility. FIXME: should we deviate??
- if (!Method && OCIReceiver->qual_empty())
+ if (!Method && OCIType->qual_empty())
Method = LookupInstanceMethodInGlobalPool(
Sel, SourceRange(lbrac,rbrac));
}
More information about the cfe-commits
mailing list