[cfe-dev] Typed selectors
David Chisnall
csdavec at swansea.ac.uk
Tue May 5 12:09:16 PDT 2009
Typed selectors are a GNU extension. This patch adds support for them
for when -fgnu-runtime is used. The code generation for the NeXT
runtime is unchanged..
David
On 5 May 2009, at 20:06, Fariborz Jahanian wrote:
> Are sel_get_name/sel_get_type Gnu extensions? If so, we do not need
> to support them in the Next runtime.
>
> - Fariborz
>
> On May 5, 2009, at 11:49 AM, David Chisnall wrote:
>
>> Hi Everyone,
>>
>> The attached diff is the start of support for typed selectors in
>> clang. Currently this only generates typed selectors in message
>> sends. GCC generates them whenever type information is available,
>> but this is not done yet for this diff. This is probably the most
>> important place for typed selectors, as it's the place that lets us
>> detect stack corruption from mismatched selector types at runtime.
>>
>> David
>>
>> P.S. Clang currently fails make test for me on codegen-gnu.m, but
>> if you delete the last line (the 'RUN: not' one) it works with the
>> diff applied and this diff now works with this test case:
>>
>>
>>
>>
>> $ clang typedsel.m -lobjc && ./a.out
>> +new type: @8 at 0:4
>> +logtype type: v8 at 0:4
>> $ cat typedsel.m#import <objc/Object.h>
>>
>> @interface A:Object{}
>> + (id)new;
>> - (void)logtype;
>> @end
>> @implementation A
>> + new
>> {
>> printf("+%s type: %s\n", sel_get_name(_cmd), sel_get_type(_cmd));
>> return [super new];
>> }
>> - (void)logtype
>> {
>> printf("+%s type: %s\n", sel_get_name(_cmd), sel_get_type(_cmd));
>> }
>> @end
>>
>> int main(void)
>> {
>> [[A new] logtype];
>> return 0;
>> }
>>
>> <clang.diff>_______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
More information about the cfe-dev
mailing list