[cfe-dev] PATCH: Cleanup function redeclaration representations

Argiris Kirtzidis akyrtzi at gmail.com
Sun May 4 15:55:58 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.

Nice, the circular list idea sounds good!


-Argiris



More information about the cfe-dev mailing list