[cfe-commits] r44025 - in /cfe/trunk: Parse/ParseObjc.cpp Sema/Sema.h Sema/SemaExpr.cpp include/clang/Parse/Action.h

Chris Lattner clattner at apple.com
Wed Dec 12 18:07:25 PST 2007


On Nov 12, 2007, at 12:13 PM, Fariborz Jahanian wrote:
> 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.

Hi Fariborz, One thing:

> +++ cfe/trunk/Sema/SemaExpr.cpp Mon Nov 12 14:13:27 2007
> @@ -2060,13 +2060,34 @@
> +  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);

This code appears to be synthesizing a definition of super on the  
fly.  This seems like exactly the same issue as self, etc.  Shouldn't  
it be handled the same way?

-Chris



More information about the cfe-commits mailing list