[cfe-dev] Message send to super

Chris Lattner clattner at apple.com
Sun May 4 14:30:26 PDT 2008


On May 2, 2008, at 5:15 PM, David Chisnall wrote:
> Hi,
>
> It appears that, in generating the AST, the following expression:
>
> [super msg];
>
> is being translated to:
>
> [(superclass*)self msg];

This is bad.  'super' 'self' '_cmd' as well as 'this' in C++ etc  
should all be handled with PreDefinedExpr, just like __func__ is.

> Running clang -ast-print confirms this.  These two expressions have
> completely different semantics in Objective-C, and since there appears
> to be no way of determining whether the user actually performed a cast
> on self (which is uncommon, but does happen in real code) or sent a
> message to super (which happens a lot more frequently).

Right.  Use of PreDefinedExpr would be be much more explicit and  
better in general for clients.

-Chris



More information about the cfe-dev mailing list