Improve the AST representation and semantic analysis for extern

templates. We now distinguish between an explicit instantiation
declaration and an explicit instantiation definition, and know not to
instantiate explicit instantiation declarations. Unfortunately, there
is some remaining confusion w.r.t. instantiation of out-of-line member
function definitions that causes trouble here.
 

llvm-svn: 81053
This commit is contained in:
Douglas Gregor
2009-09-04 22:48:11 +00:00
parent 21d15aa591
commit 34ec2ef159
10 changed files with 143 additions and 91 deletions

View File

@@ -250,9 +250,8 @@ GetLinkageForFunction(ASTContext &Context, const FunctionDecl *FD,
// The kind of external linkage this function will have, if it is not
// inline or static.
CodeGenModule::GVALinkage External = CodeGenModule::GVA_StrongExternal;
if (Context.getLangOptions().CPlusPlus &&
(FD->getPrimaryTemplate() || FD->getInstantiatedFromMemberFunction()) &&
!FD->isExplicitSpecialization())
if (Context.getLangOptions().CPlusPlus &&
FD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation)
External = CodeGenModule::GVA_TemplateInstantiation;
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {