[cfe-dev] PATCH: Cleanup function redeclaration representations

Argiris Kirtzidis akyrtzi at gmail.com
Sun May 4 17:33:53 PDT 2008


Doug Gregor wrote:
> On Sun, May 4, 2008 at 5:34 PM, Chris Lattner <clattner at apple.com> wrote:
>   
>>  On May 4, 2008, at 11:42 AM, Doug Gregor wrote:
>>  That is a great point, would it be reasonable to just always make the
>> aggregate version by the one returned by scope lookups?
>>     
>
> That would make me very, very happy, if that also implies that
> everything in the AST will refer to the aggregate version (except, of
> course, the list of redeclarations). Can we do this without always
> having an aggregate node? I'm not sure we can, because we run into
> trouble like this:
>
>   void foo(int); // #1: no aggregate
>   void bar(int i) { foo(i); }
>   void foo(int x) { ... } // #2: now we create the aggregate, but
> bar() points at #2.
>
> This is why I ended up with the swapping mess in the first place. Argh!
>   

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()


-Argiris



More information about the cfe-dev mailing list