summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2011-04-14 14:07:59 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2011-04-14 14:07:59 +0000
commit9ab988fe00b803c15cc9450ecb4926d53ebf32ba (patch)
tree88d486e8808b0861eb74303a4d0fb48206d9a88a /clang/lib/AST
parent05d73a10a2164a134b3bc23571736093f6db1d1c (diff)
downloadbcm5719-llvm-9ab988fe00b803c15cc9450ecb4926d53ebf32ba.tar.gz
bcm5719-llvm-9ab988fe00b803c15cc9450ecb4926d53ebf32ba.zip
Chained PCH: Remember when additional specializations are added to a function template from a previous PCH. Fixes the only crasher when using massive chains on Clang's Sema component. We still have some incomplete codegen there.
llvm-svn: 129516
Diffstat (limited to 'clang/lib/AST')
-rw-r--r--clang/lib/AST/Decl.cpp2
-rw-r--r--clang/lib/AST/DeclTemplate.cpp7
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index dfa53881f1a..99a180662dd 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1893,7 +1893,7 @@ FunctionDecl::setFunctionTemplateSpecialization(ASTContext &C,
// Insert this function template specialization into the set of known
// function template specializations.
if (InsertPos)
- Template->getSpecializations().InsertNode(Info, InsertPos);
+ Template->addSpecialization(Info, InsertPos);
else {
// Try to insert the new node. If there is an existing node, leave it, the
// set will contain the canonical decls while
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index ae17dd15b12..73c91dbd72b 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -242,6 +242,13 @@ FunctionTemplateDecl::findSpecialization(const TemplateArgument *Args,
return findSpecializationImpl(getSpecializations(), Args, NumArgs, InsertPos);
}
+void FunctionTemplateDecl::addSpecialization(
+ FunctionTemplateSpecializationInfo *Info, void *InsertPos) {
+ getSpecializations().InsertNode(Info, InsertPos);
+ if (ASTMutationListener *L = getASTMutationListener())
+ L->AddedCXXTemplateSpecialization(this, Info->Function);
+}
+
std::pair<const TemplateArgument *, unsigned>
FunctionTemplateDecl::getInjectedTemplateArgs() {
TemplateParameterList *Params = getTemplateParameters();
OpenPOWER on IntegriCloud