[cfe-dev] VarDecl hierarchy (Re: Objective-C tidy up)

David Chisnall csdavec at swansea.ac.uk
Mon Jun 9 15:06:27 PDT 2008


On 9 Jun 2008, at 20:39, Steve Naroff wrote:

>> It seems that there are a lot of bits of the analyses that assume
>> VarDecls.  This is a bit messy, since ParmVarDecls, as VarDecl
>> subclasses, store a SClass which is always None and their Init  
>> pointer
>> is always 0.
>>
>
> I don't believe this is true. For example, "register" is a legal
> storage class for parms.

This doesn't appear to be set, but possibly it will be in the future.   
Register doesn't really make sense for an implicit parameter, since  
the calling convention for functions with implicit parameters is only  
relevant to code generation.

> In addition, the Init pointer will come in handy for C++ (default
> arguments).

ParmVarDecl defines a new pointer for this.  Presumably this is to  
avoid confusing analyses that dyn_cast them to a VarDecl and then  
expect the init pointer expression to be the initial value, which  
won't be true all of the time in C++.

David



More information about the cfe-dev mailing list