[cfe-dev] PATCH: Cleanup function redeclaration representations

Argiris Kirtzidis akyrtzi at gmail.com
Sun May 4 15:57:06 PDT 2008


Doug Gregor wrote:
> With Argiris' tweak, I almost like it. I'm concerned about the
> programmability of this system, where the FunctionDecl node that is
> found by name lookup is not the 'aggregate' node. As with the
> canonical type system, clients will have to be very careful to always
> map into the 'aggregate' node before querying any properties. With the
> canonical type system, we need to do the mapping because we need to
> preserve typedefs in the AST. With declarations, however, the
> complexity isn't coming directly from the language... it's coming from
> the representation. It will take a lot of discipline to use
> FunctionDecls properly if name lookup doesn't find the 'aggregate'
> FunctionDecl. (Among other things, we'll have to audit the whole Clang
> code-base to see where we need to add GetAggregateDecl calls. Errors
> here are likely to be subtle.).
>   

That's a good point. I don't have a strong opinion on whether there 
should be a separate 'aggregate' node or not, but assuming that there 
is, can the semantic info for a function decl refer to the aggregate one 
for all redecls but for decl specific info you'll use separate methods ?
I mean, getbody() would return the body of the aggregate for all 
redecls, but you would also have a isThisDefinition() to probe the 
specific decl. Same for default arguments.
Is this practical ?


-Argiris



More information about the cfe-dev mailing list