summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-20 13:59:58 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-20 13:59:58 +0000
commitdde579056237504c1ff12237ef81ceda4a4fe1f5 (patch)
tree7783acef92eb1e4873928c9ed0e27aafdae19a69 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
parentc1624e9edace092867861866d039d123276079cf (diff)
downloadbcm5719-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/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp28
1 files changed, 10 insertions, 18 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 7e0617568bf..4209fd7a14b 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -968,20 +968,16 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
FunctionTemplateDecl *FunctionTemplate = D->getDescribedFunctionTemplate();
void *InsertPos = 0;
if (FunctionTemplate && !TemplateParams) {
- llvm::FoldingSetNodeID ID;
std::pair<const TemplateArgument *, unsigned> Innermost
= TemplateArgs.getInnermost();
- FunctionTemplateSpecializationInfo::Profile(ID, Innermost.first,
- Innermost.second,
- SemaRef.Context);
- FunctionTemplateSpecializationInfo *Info
- = FunctionTemplate->getSpecializations().FindNodeOrInsertPos(ID,
- InsertPos);
+ FunctionDecl *SpecFunc
+ = FunctionTemplate->findSpecialization(Innermost.first, Innermost.second,
+ InsertPos);
// If we already have a function template specialization, return it.
- if (Info)
- return Info->Function;
+ if (SpecFunc)
+ return SpecFunc;
}
bool isFriend;
@@ -1222,20 +1218,16 @@ TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D,
// We are creating a function template specialization from a function
// template. Check whether there is already a function template
// specialization for this particular set of template arguments.
- llvm::FoldingSetNodeID ID;
std::pair<const TemplateArgument *, unsigned> Innermost
= TemplateArgs.getInnermost();
- FunctionTemplateSpecializationInfo::Profile(ID, Innermost.first,
- Innermost.second,
- SemaRef.Context);
- FunctionTemplateSpecializationInfo *Info
- = FunctionTemplate->getSpecializations().FindNodeOrInsertPos(ID,
- InsertPos);
+ FunctionDecl *SpecFunc
+ = FunctionTemplate->findSpecialization(Innermost.first, Innermost.second,
+ InsertPos);
// If we already have a function template specialization, return it.
- if (Info)
- return Info->Function;
+ if (SpecFunc)
+ return SpecFunc;
}
bool isFriend;
OpenPOWER on IntegriCloud