[cfe-dev] Objective-C tidy up

Ted Kremenek kremenek at apple.com
Tue Jun 3 08:41:45 PDT 2008


On Jun 3, 2008, at 8:37 AM, David Chisnall wrote:

> On 3 Jun 2008, at 16:32, Ted Kremenek wrote:
>
>>
>> On Jun 3, 2008, at 4:39 AM, David Chisnall wrote:
>>
>>>> Why should self and _cmd be ParmVarDecls?  Shouldn't they be
>>>> PredefinedExprs?
>>>
>>> That's what I did to start with, but PredefinedExprs need special
>>> handling in codegen, while ParmVarDecls are automatically turned  
>>> into
>>> loads of %var.addr.  Since they are parameters, and since it
>>> simplifies the rest of the implementation, it seemed like a
>>> ParmVarDecl would be the right thing to choose.
>>
>> The codegen is not the only consumer of the ASTs.  We should go  
>> with the solution that makes more sense in the general case.
>
> To me, having parameters being ParamVarDecls did make more sense in  
> the general case.  It is also more flexible - if they are  
> PredefinedExprs, then you are going to need extra special cases in  
> all of these AST consumers for each runtime that exposes others.  If  
> they are ParamVarDecls then you use the same handling in your  
> consumer for implicit and explicit parameters unless you explicitly  
> need to know the difference.

This makes a lot of sense to me.  I can see a similar argument for  
"this" in C++.

Chris: What was your main insight on using PredefinedExprs instead?



More information about the cfe-dev mailing list