summaryrefslogtreecommitdiffstats
path: root/clang/lib
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
commit1a68ab6c83e5fdd1a4d75fd4bdfc216498831735 (patch)
tree6c94b3bb2a1caa439cc485e99c5d0c26b987cafb /clang/lib
parentaee326860c6f6ab8fdb7485dfb8841df8f925f74 (diff)
downloadbcm5719-llvm-1a68ab6c83e5fdd1a4d75fd4bdfc216498831735.tar.gz
bcm5719-llvm-1a68ab6c83e5fdd1a4d75fd4bdfc216498831735.zip
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. llvm-svn: 92779
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGVtable.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGVtable.cpp b/clang/lib/CodeGen/CGVtable.cpp
index ca148da9560..ccbb10505e5 100644
--- a/clang/lib/CodeGen/CGVtable.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud