[cfe-dev] [PATCH] Function redeclaration and PR2360

Ted Kremenek kremenek at apple.com
Tue May 27 08:44:07 PDT 2008

On May 25, 2008, at 2:32 AM, Eli Friedman wrote:

> This means that references to a function before a
> redeclaration refer to the old declaration, and references to a
> function after a redeclaration refer to the new declaration.

I like the idea of having multiple FunctionDecls, and this will be  
useful for any client that wishes to perform source-level  
transformations.  For example, refactoring clients will need to know  
the location of every function declaration corresponding to the same  

One caveat: if a client inspects two separate DeclRefExprs, each one  
referring to a different FunctionDecl for the same function, is there  
a good, standard way to compare if they refer to the same function?   
It would be nice if we didn't have to do a full traversal of the  
"PreviousDeclaration" list for both FunctionDecls.  From an efficiency  
standpoint, the number of redeclarations is small, so doing the list  
traversal itself might not matter, but it might be nice to have  
something like a Decl::isEqual method that could be used to compare if  
two Decls are "the same" from a semantic perspective.

More information about the cfe-dev mailing list