[cfe-commits] r94246 - in /cfe/trunk: lib/Sema/SemaExprObjC.cpp test/SemaObjC/super.m
Fariborz Jahanian
fjahanian at apple.com
Fri Jan 22 15:04:44 PST 2010
Author: fjahanian
Date: Fri Jan 22 17:04:44 2010
New Revision: 94246
URL: http://llvm.org/viewvc/llvm-project?rev=94246&view=rev
Log:
outside a method, 'super' should resolve in a normal name look up
to mimic gcc's behavior. Fixes radar 7400691.
Modified:
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/test/SemaObjC/super.m
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=94246&r1=94245&r2=94246&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Fri Jan 22 17:04:44 2010
@@ -398,7 +398,17 @@
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);
Modified: cfe/trunk/test/SemaObjC/super.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/super.m?rev=94246&r1=94245&r2=94246&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/super.m (original)
+++ cfe/trunk/test/SemaObjC/super.m Fri Jan 22 17:04:44 2010
@@ -39,3 +39,10 @@
void f1(int puper) {
[super m]; // expected-error{{use of undeclared identifier 'super'}}
}
+
+// radar 7400691
+typedef Foo super;
+
+void test() {
+ [super cMethod];
+}
More information about the cfe-commits
mailing list