[cfe-commits] r75602 - in /cfe/trunk: include/clang/AST/Decl.h lib/AST/Decl.cpp

Argyrios Kyrtzidis kyrtzidis at apple.com
Tue Jul 14 00:33:25 PDT 2009


On Jul 13, 2009, at 11:57 PM, Douglas Gregor wrote:

>
> On Jul 14, 2009, at 5:19 AM, Argiris Kirtzidis wrote:
>
>> Author: akirtzidis
>> Date: Mon Jul 13 22:19:57 2009
>> New Revision: 75602
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=75602&view=rev
>> Log:
>> Introduce FunctionDecl::getFirstDeclaration() and
>> VarDecl::getFirstDeclaration().
>>
>> For multiple redeclarations they return the first one.
>
> ASTContext::getCanonicalDecl does the same thing for functions,
> variables, function templates, class templates, etc. Why not use that?

Ah, I wasn't aware of that. That overlaps with the virtual  
Decl::getPrimaryDecl() I had added.
Should we keep a virtual Decl::getCanonicalDecl() ? That way we won't  
need to go to the ASTContext for this.

getFirstDeclaration() seems more specific (whether getCanonicalDecl  
returns the first declaration or not is an implementation detail).
No strong opinion on this though, let me know if you think I should  
remove it.

-Argiris



More information about the cfe-commits mailing list