[cfe-dev] override support for Objective-C

jahanian fjahanian at apple.com
Mon Nov 29 16:22:39 PST 2010


On Nov 29, 2010, at 4:09 PM, Stuart Carnie wrote:

> Hi all,
> 
> I would like to have a go at hacking a little on Clang when a get a bit of spare time, and have found that adding support for override would be useful little exercise.  I've seen another post referring to Clang's support for __attribute__((override)), and seems like I could use this as a starting point.
> 
> Big Nerd Ranch would like to see an @override keyword, as follows:
> 
> @override
> - (NSInteger)numberOfSectionsInTableview:(UITableView *)tv
> { ... }
> 
> This would seem the most natural, but I feel it would involve mucking with the parser, the AST and therefore fairly complicated.  Given Clang already parses __attribute__, I could take the following approach instead:
> 
> - (NSInteger)numberOfSectionsInTableview:(UITableView *)tv __attribute__((override))
> { ... }
> 

attribute is preferred but, first you need to implement it for .cpp (as it is intended for), and then see if it makes sense to do same for
an objc method. I don't know its c++ semantics so I cannot make any comment on its usefulness for objc methods.

- Fariborz


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101129/a51dee47/attachment.html>


More information about the cfe-dev mailing list