outside a method, 'super' should resolve in a normal name look up

to mimic gcc's behavior. Fixes radar 7400691.

llvm-svn: 94246
This commit is contained in:
Fariborz Jahanian 2010-01-22 23:04:44 +00:00
parent 690818fc27
commit 935f041243
2 changed files with 18 additions and 1 deletions

View File

@ -398,7 +398,17 @@ Sema::ExprResult Sema::ActOnClassMessage(
return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac,
selectorLoc, rbrac, Args, NumArgs);
}
return Diag(receiverLoc, diag::err_undeclared_var_use) << receiverName;
else if (TypedefDecl *OCTD = dyn_cast_or_null<TypedefDecl>(SuperDecl)) {
const ObjCInterfaceType *OCIT;
OCIT = OCTD->getUnderlyingType()->getAs<ObjCInterfaceType>();
if (!OCIT) {
Diag(receiverLoc, diag::err_invalid_receiver_to_message);
return true;
}
ClassDecl = OCIT->getDecl();
}
else
return Diag(receiverLoc, diag::err_undeclared_var_use) << receiverName;
}
} else
ClassDecl = getObjCInterfaceDecl(receiverName, receiverLoc);

View File

@ -39,3 +39,10 @@ void f0(int super) {
void f1(int puper) {
[super m]; // expected-error{{use of undeclared identifier 'super'}}
}
// radar 7400691
typedef Foo super;
void test() {
[super cMethod];
}