[cfe-dev] PATCH: Cleanup function redeclaration representations

Doug Gregor doug.gregor at gmail.com
Sun May 4 17:10:00 PDT 2008


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!

> > One
> > could imagine that each function only has a single FunctionDecl, which
> > represents the aggregate declaration. That FunctionDecl contains a
> > SmallVector<FunctionRedecl*, 2>, where each FunctionRedecl contains
> > minimal information about a redeclaration... the exact types used in
> > the parameter-type-list, the attributes, whether it was the
> > definition, etc.
> >
>
>  That is an interesting idea.  I think that it could be done as a refinement
> on the first step of getting the current plan in place, do you agree?

Yes, it could.

> Great!  Incidentally, is there a better name than 'aggregate' for these? :)  How about
> Accumulated or something else?

Well, there's always "Canonical" :)

  - Doug



More information about the cfe-dev mailing list