diff options
author | Anders Carlsson <andersca@mac.com> | 2009-12-10 22:25:34 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-12-10 22:25:34 +0000 |
commit | 781161dc55edbbf5f95a9d6e52d1b9bd2348bdcb (patch) | |
tree | fc0da38226541580b51a07f8f85c6f0695d4a743 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 96156a46e0c91641c909d4287ee7f77b75583484 (diff) | |
download | bcm5719-llvm-781161dc55edbbf5f95a9d6e52d1b9bd2348bdcb.tar.gz bcm5719-llvm-781161dc55edbbf5f95a9d6e52d1b9bd2348bdcb.zip |
Make sure that explicitly instantiated functions get the right linkage.
llvm-svn: 91069
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index e98939cc8f4..3a0d2b8ddcb 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -256,9 +256,18 @@ 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->getTemplateSpecializationKind() == TSK_ImplicitInstantiation) - External = CodeGenModule::GVA_TemplateInstantiation; + if (Context.getLangOptions().CPlusPlus) { + TemplateSpecializationKind TSK = FD->getTemplateSpecializationKind(); + + if (TSK == TSK_ExplicitInstantiationDefinition) { + // If a function has been explicitly instantiated, then it should + // always have strong external linkage. + return CodeGenModule::GVA_StrongExternal; + } + + if (TSK == TSK_ImplicitInstantiation) + External = CodeGenModule::GVA_TemplateInstantiation; + } if (!FD->isInlined()) return External; |