From dde579056237504c1ff12237ef81ceda4a4fe1f5 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Tue, 20 Jul 2010 13:59:58 +0000 Subject: Hide FunctionTemplateDecl's specializations folding set as implementation detail and introduce FunctionTemplateDecl::findSpecialization. Redeclarations of specializations will not cause the previous decl to be removed from the set, the set will keep the canonical decl. findSpecialization will return the most recent redeclaration. llvm-svn: 108834 --- clang/lib/AST/DeclTemplate.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'clang/lib/AST/DeclTemplate.cpp') diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp index a75c1c0d582..f308d71d5f6 100644 --- a/clang/lib/AST/DeclTemplate.cpp +++ b/clang/lib/AST/DeclTemplate.cpp @@ -119,6 +119,16 @@ void FunctionTemplateDecl::Destroy(ASTContext &C) { Decl::Destroy(C); } +FunctionDecl * +FunctionTemplateDecl::findSpecialization(const TemplateArgument *Args, + unsigned NumArgs, void *&InsertPos) { + llvm::FoldingSetNodeID ID; + FunctionTemplateSpecializationInfo::Profile(ID,Args,NumArgs, getASTContext()); + FunctionTemplateSpecializationInfo *Info + = getSpecializations().FindNodeOrInsertPos(ID, InsertPos); + return Info ? Info->Function->getMostRecentDeclaration() : 0; +} + FunctionTemplateDecl *FunctionTemplateDecl::getCanonicalDecl() { FunctionTemplateDecl *FunTmpl = this; while (FunTmpl->getPreviousDeclaration()) -- cgit v1.2.3