[cfe-dev] PATCH: Cleanup function redeclaration representations

Doug Gregor doug.gregor at gmail.com
Sun May 4 17:42:02 PDT 2008


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.

  - Doug



More information about the cfe-dev mailing list