[cfe-dev] override support for Objective-C
Stuart Carnie
stuart.carnie at gmail.com
Mon Nov 29 16:09:33 PST 2010
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 <http://weblog.bignerdranch.com/?p=171> 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))
{ ... }
Can I implement this as a Clang plugin or must I modify Clang source?
One other question is I couldn't get Clang 2.8 to recognize
__has_attribute(override) for a .cpp file:
#ifndef __has_attribute
#define __has_attribute(x) 0
#warning no __has_attribute support
#endif
#if __has_attribute(override)
#define OVERRIDE __attribute__((override))
#else
#warning No override attribute
#endif
Would always output the two warnings.
Cheers,
Stu
*Stuart Carnie, CTO*
*manomio <http://manomio.com/> | in retro we trust!*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101129/29063d0d/attachment.html>
More information about the cfe-dev
mailing list