aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-06-22 23:06:13 +0000
committerDouglas Gregor <dgregor@apple.com>2009-06-22 23:06:13 +0000
commitd7f37bf8b9a211455c5037df7b7e88e5a9510119 (patch)
tree3e2f8b4bdfc41b7836ecf45752dbce8b5e831fde /lib/Sema/SemaTemplateInstantiateDecl.cpp
parent2f96a0679a8d9c05fd3634340421f2d360701059 (diff)
Implement implicit instantiation of the member functions of a class template
specialization. At present, all implicit instantiations occur at the end of the translation unit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73915 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 461302f81d..ece71bc0d3 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -597,6 +597,8 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
if (Function->isInvalidDecl())
return;
+ assert(!Function->getBody(Context) && "Already instantiated!");
+
// Find the function body that we'll be substituting.
const FunctionDecl *PatternDecl
= Function->getInstantiatedFromMemberFunction();
@@ -776,3 +778,18 @@ NamedDecl * Sema::InstantiateCurrentDeclRef(NamedDecl *D) {
return D;
}
+
+/// \brief Performs template instantiation for all implicit template
+/// instantiations we have seen until this point.
+void Sema::PerformPendingImplicitInstantiations() {
+ while (!PendingImplicitInstantiations.empty()) {
+ PendingImplicitInstantiation Inst = PendingImplicitInstantiations.front();
+ PendingImplicitInstantiations.pop();
+
+ if (FunctionDecl *Function = dyn_cast<FunctionDecl>(Inst.first))
+ if (!Function->getBody(Context))
+ InstantiateFunctionDefinition(/*FIXME:*/Inst.second, Function);
+
+ // FIXME: instantiation static member variables
+ }
+}