[cfe-dev] Message send to super

David Chisnall csdavec at swansea.ac.uk
Fri May 2 17:15:57 PDT 2008


It appears that, in generating the AST, the following expression:

[super msg];

is being translated to:

[(superclass*)self msg];

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).

Can anyone suggest a way of distinguishing these two?  If not, is it  
possible to introduce a separate kind of AST node, or a flag in the  
ObjCMessageExpr indicating if super is the receiver?  I have now  
written the code to produce the correct output for the GNU runtime  
with this kind of expression, but am currently unable to connect it to  


More information about the cfe-dev mailing list