Introduce basic support for instantiating the definitions of member
functions of class templates. Only compound statements and expression
statements are currently implemented.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71814 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 1453dcf..6f65288 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -2391,27 +2391,19 @@
}
}
- // Find the enclosing template, because we need its template
- // arguments to instantiate this class.
- DeclContext *EnclosingTemplateCtx = Record->getDeclContext();
- while (!isa<ClassTemplateSpecializationDecl>(EnclosingTemplateCtx))
- EnclosingTemplateCtx = EnclosingTemplateCtx->getParent();
- ClassTemplateSpecializationDecl *EnclosingTemplate
- = cast<ClassTemplateSpecializationDecl>(EnclosingTemplateCtx);
-
if (!Record->getDefinition(Context)) {
// If the class has a definition, instantiate it (and all of its
// members, recursively).
Pattern = cast_or_null<CXXRecordDecl>(Pattern->getDefinition(Context));
if (Pattern && InstantiateClass(TemplateLoc, Record, Pattern,
- EnclosingTemplate->getTemplateArgs(),
+ getTemplateInstantiationArgs(Record),
/*ExplicitInstantiation=*/true))
return true;
} else {
// Instantiate all of the members of class.
InstantiatingTemplate Inst(*this, TemplateLoc, Record);
InstantiateClassMembers(TemplateLoc, Record,
- EnclosingTemplate->getTemplateArgs());
+ getTemplateInstantiationArgs(Record));
}
// FIXME: We don't have any representation for explicit