[cfe-commits] r44025 - in /cfe/trunk: Parse/ParseObjc.cpp Sema/Sema.h Sema/SemaExpr.cpp include/clang/Parse/Action.h
Fariborz Jahanian
fjahanian at apple.com
Mon Nov 12 12:13:27 PST 2007
Author: fjahanian
Date: Mon Nov 12 14:13:27 2007
New Revision: 44025
URL: http://llvm.org/viewvc/llvm-project?rev=44025&view=rev
Log:
'super' nailed.
Modified:
cfe/trunk/Parse/ParseObjc.cpp
cfe/trunk/Sema/Sema.h
cfe/trunk/Sema/SemaExpr.cpp
cfe/trunk/include/clang/Parse/Action.h
Modified: cfe/trunk/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Parse/ParseObjc.cpp?rev=44025&r1=44024&r2=44025&view=diff
==============================================================================
--- cfe/trunk/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/Parse/ParseObjc.cpp Mon Nov 12 14:13:27 2007
@@ -1237,7 +1237,8 @@
ExprTy *ReceiverExpr = 0;
// Parse receiver
if (Tok.is(tok::identifier) &&
- Actions.isTypeName(*Tok.getIdentifierInfo(), CurScope)) {
+ (Actions.isTypeName(*Tok.getIdentifierInfo(), CurScope)
+ || !strcmp(Tok.getIdentifierInfo()->getName(), "super"))) {
ReceiverName = Tok.getIdentifierInfo();
ConsumeToken();
} else {
@@ -1308,7 +1309,8 @@
// We've just parsed a keyword message.
if (ReceiverName)
- return Actions.ActOnClassMessage(ReceiverName, Sel, LBracloc, RBracloc,
+ return Actions.ActOnClassMessage(CurScope,
+ ReceiverName, Sel, LBracloc, RBracloc,
&KeyExprs[0]);
return Actions.ActOnInstanceMessage(ReceiverExpr, Sel, LBracloc, RBracloc,
&KeyExprs[0]);
Modified: cfe/trunk/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/Sema.h?rev=44025&r1=44024&r2=44025&view=diff
==============================================================================
--- cfe/trunk/Sema/Sema.h (original)
+++ cfe/trunk/Sema/Sema.h Mon Nov 12 14:13:27 2007
@@ -565,6 +565,7 @@
// ArgExprs is optional - if it is present, the number of expressions
// is obtained from Sel.getNumArgs().
virtual ExprResult ActOnClassMessage(
+ Scope *S,
IdentifierInfo *receivingClassName, Selector Sel,
SourceLocation lbrac, SourceLocation rbrac, ExprTy **ArgExprs);
Modified: cfe/trunk/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaExpr.cpp?rev=44025&r1=44024&r2=44025&view=diff
==============================================================================
--- cfe/trunk/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/Sema/SemaExpr.cpp Mon Nov 12 14:13:27 2007
@@ -2060,13 +2060,34 @@
// ArgExprs is optional - if it is present, the number of expressions
// is obtained from Sel.getNumArgs().
Sema::ExprResult Sema::ActOnClassMessage(
+ Scope *S,
IdentifierInfo *receiverName, Selector Sel,
SourceLocation lbrac, SourceLocation rbrac, ExprTy **Args)
{
assert(receiverName && "missing receiver class name");
Expr **ArgExprs = reinterpret_cast<Expr **>(Args);
- ObjcInterfaceDecl* ClassDecl = getObjCInterfaceDecl(receiverName);
+ ObjcInterfaceDecl* ClassDecl = 0;
+ if (!strcmp(receiverName->getName(), "super") && CurMethodDecl) {
+ ClassDecl = CurMethodDecl->getClassInterface()->getSuperClass();
+ if (CurMethodDecl->isInstance()) {
+ IdentifierInfo &II = Context.Idents.get("self");
+ ExprResult ReceiverExpr = ActOnIdentifierExpr(S, lbrac, II,
+ false);
+ QualType superTy = Context.getObjcInterfaceType(ClassDecl);
+ superTy = Context.getPointerType(superTy);
+ ReceiverExpr = ActOnCastExpr(SourceLocation(), superTy.getAsOpaquePtr(),
+ SourceLocation(), ReceiverExpr.Val);
+
+ return ActOnInstanceMessage(ReceiverExpr.Val, Sel, lbrac, rbrac,
+ Args);
+ }
+ // class method
+ if (ClassDecl)
+ receiverName = ClassDecl->getIdentifier();
+ }
+ else
+ ClassDecl = getObjCInterfaceDecl(receiverName);
ObjcMethodDecl *Method = ClassDecl->lookupClassMethod(Sel);
QualType returnType;
Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=44025&r1=44024&r2=44025&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Mon Nov 12 14:13:27 2007
@@ -591,6 +591,7 @@
// ArgExprs is optional - if it is present, the number of expressions
// is obtained from Sel.getNumArgs().
virtual ExprResult ActOnClassMessage(
+ Scope *S,
IdentifierInfo *receivingClassName,
Selector Sel,
SourceLocation lbrac,
More information about the cfe-commits
mailing list