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 | 548e60efea9a1d2c31679e11e9ff0d2f19b96694 (patch) | |
tree | 3e2d27d22d7576821529b48edc4103ca221f3f19 /lib/CodeGen/CodeGenModule.cpp | |
parent | 5f16e521ebb2e99fc07970545083fa07426e39d1 (diff) |
Make sure that explicitly instantiated functions get the right linkage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91069 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index e98939cc8f..3a0d2b8ddc 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/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; |