[cfe-dev] PATCH: Cleanup function redeclaration representations

Chris Lattner clattner at apple.com
Mon May 5 14:15:35 PDT 2008


On May 4, 2008, at 5:42 PM, Doug Gregor wrote:

> On Sun, May 4, 2008 at 6:33 PM, Argiris Kirtzidis  
> <akyrtzi at gmail.com> wrote:
>> Another idea to throw around..
>> If there is a need, instead of creating a separate aggregate we  
>> create a
>> separate decl to store the source info of the first decl, and have  
>> the first
>> decl be the aggregate one.
>> I mean, the first decl will always be the aggregate and if the  
>> client wants
>> the source info for it he would do:
>>
>> aggregate_decl->getSourceDecl()->isInline()
>
> Hmmm, I like that. Actually, why not replace the term "redeclaration"
> with "source declaration"? The 'aggregate' ('canonical'?) node will be
> the first node created and the one used throughout the AST. If one is
> interested in source information, browse the source-declarations list.
>
> For functions that have only one declaration (ever), we would just
> have the one FunctionDecl. However, once we see a second declaration,
> we create two source declarations: one for the original declaration
> (basically, a clone of the aggregate decl) and one for the
> redeclaration.

This is a great idea, sounds good to me.

-Chris




More information about the cfe-dev mailing list