aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGVtable.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-01-05 21:40:05 +0000
committerDouglas Gregor <dgregor@apple.com>2010-01-05 21:40:05 +0000
commit074a2cf3c51229b90b77e998463530c9b06470e6 (patch)
tree23eba385bdac74a00b29a68ede0f517ad11c3e07 /lib/CodeGen/CGVtable.cpp
parentdb3d0da170e41f220823f2eb6f978989743bf143 (diff)
Make use of available_externally linkage for vtables when the
non-inline key function of a class template instantiation, when no key function is present, the class template instantiation itself was instantiated with an explicit instantiation declaration (aka extern template). I'm fairly certain that the C++0x specification gives us this lattitude, although GCC doesn't take advantage of it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVtable.cpp')
-rw-r--r--lib/CodeGen/CGVtable.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/lib/CodeGen/CGVtable.cpp b/lib/CodeGen/CGVtable.cpp
index ca148da956..ccbb10505e 100644
--- a/lib/CodeGen/CGVtable.cpp
+++ b/lib/CodeGen/CGVtable.cpp
@@ -1501,16 +1501,31 @@ void CGVtableInfo::MaybeEmitVtable(GlobalDecl GD) {
break;
case TSK_ImplicitInstantiation:
- case TSK_ExplicitInstantiationDeclaration:
- // FIXME: could an explicit instantiation declaration imply
- // available_externally linkage?
case TSK_ExplicitInstantiationDefinition:
Linkage = llvm::GlobalVariable::WeakODRLinkage;
break;
+
+ case TSK_ExplicitInstantiationDeclaration:
+ Linkage = llvm::GlobalVariable::AvailableExternallyLinkage;
+ break;
}
}
- else
+ else if (KeyFunction)
Linkage = llvm::GlobalVariable::WeakODRLinkage;
+ else {
+ switch (RD->getTemplateSpecializationKind()) {
+ case TSK_Undeclared:
+ case TSK_ExplicitSpecialization:
+ case TSK_ImplicitInstantiation:
+ case TSK_ExplicitInstantiationDefinition:
+ Linkage = llvm::GlobalVariable::WeakODRLinkage;
+ break;
+
+ case TSK_ExplicitInstantiationDeclaration:
+ Linkage = llvm::GlobalVariable::AvailableExternallyLinkage;
+ break;
+ }
+ }
// Emit the data.
GenerateClassData(Linkage, RD);