diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-20 13:59:58 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-20 13:59:58 +0000 |
commit | dde579056237504c1ff12237ef81ceda4a4fe1f5 (patch) | |
tree | 7783acef92eb1e4873928c9ed0e27aafdae19a69 /clang/lib/AST/DeclTemplate.cpp | |
parent | c1624e9edace092867861866d039d123276079cf (diff) | |
download | bcm5719-llvm-dde579056237504c1ff12237ef81ceda4a4fe1f5.tar.gz bcm5719-llvm-dde579056237504c1ff12237ef81ceda4a4fe1f5.zip |
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
Diffstat (limited to 'clang/lib/AST/DeclTemplate.cpp')
-rw-r--r-- | clang/lib/AST/DeclTemplate.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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()) |