[cfe-dev] PATCH: Cleanup function redeclaration representations

Argiris Kirtzidis akyrtzi at gmail.com
Sun May 4 16:17:11 PDT 2008


Chris Lattner wrote:
>
> Ah, you're saying that because you are given the end of the list, you 
> can't just walk it.  Great point :).  Maybe the right solution is to 
> build it so that the list is in the current order but that the 
> aggregate version (if present) is always at the start of the list.  
> Subsequent redecls would be added right after the aggregate?  In fact, 
> if the list was circular, clients could then walk all of them.  In 
> this case we would end up with:
>
> void foo(int x, int y);  // #1
> 1: foo [nextredecl=null]    void foo(int x, int y);
>
> the consumer receives #1 (through HandleTopLevelDecl() )
>
>
> Then:
>
> void foo(int x, int y=2);  // #2
>
> 1: foo [nextredecl=A]    void foo(int x, int y);
> 2: foo [nextredecl=1]    void foo(int x, int y=2);
> A: foo [nextredecl=2]    void foo(int x, int y=2);
>
> The consumer receives #2 :
> 2: foo [nextredecl=null]   void foo(int x, int y=2);
>
> This way they can get #1 from #2, and they can even get A from 2... 
> but that Sema can poke A efficiently.

Oh, if a separate aggregate is not created because #1 is the aggregate:

1: foo [nextredecl=2]    void foo(int x, int y);
2: foo [nextredecl=1]    void foo(int x, int y);

You need a 'isAggregate' bool then; this seems to negate the benefit 
over the double linked list, is this correct ?




More information about the cfe-dev mailing list