[cfe-dev] VarDecl hierarchy (Re: Objective-C tidy up)
Steve Naroff
snaroff at apple.com
Mon Jun 9 15:24:53 PDT 2008
On Jun 9, 2008, at 3:06 PM, David Chisnall wrote:
> 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.
>
There are plenty of things you can "say" in C that don't make sense.
That said, it is legal to declare say "void func(register int a)" (and
therefore needs to be preserved in the AST).
>> 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++.
>
That seems wasteful (and should be fixed)...
snaroff
> David
More information about the cfe-dev
mailing list