aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGVTables.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-08-04 08:34:44 +0000
committerJohn McCall <rjmccall@apple.com>2010-08-04 08:34:44 +0000
commitcbfe50224b19119e759802bd0c1463269dffd09e (patch)
treee7d15b5599d9f22a0502f085031bd854574cf50b /lib/CodeGen/CGVTables.cpp
parent72905cfa81cfd126f322c4173f56d332aac5539e (diff)
Emit standard-library RTTI with external linkage, not weak_odr.
Apply hidden visibility to most RTTI; libstdc++ does not rely on exact pointer equality for the type info (just the type info names). Apply the same optimization to RTTI that we do to vtables. Fixes PR5962. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110192 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVTables.cpp')
-rw-r--r--lib/CodeGen/CGVTables.cpp34
1 files changed, 1 insertions, 33 deletions
diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp
index 9cb64c6d5b..db405d3673 100644
--- a/lib/CodeGen/CGVTables.cpp
+++ b/lib/CodeGen/CGVTables.cpp
@@ -2925,39 +2925,7 @@ CodeGenVTables::EmitVTableDefinition(llvm::GlobalVariable *VTable,
VTable->setLinkage(Linkage);
// Set the right visibility.
- CGM.setGlobalVisibility(VTable, RD);
-
- // It's okay to have multiple copies of a vtable, so don't make the
- // dynamic linker unique them. Suppress this optimization if it's
- // possible that there might be unresolved references elsewhere
- // which can only be resolved by this emission.
- if (Linkage == llvm::GlobalVariable::WeakODRLinkage &&
- VTable->getVisibility() == llvm::GlobalVariable::DefaultVisibility &&
- !RD->hasAttr<VisibilityAttr>()) {
- switch (RD->getTemplateSpecializationKind()) {
-
- // Every use of a non-template or explicitly-specialized class's
- // vtable has to emit it.
- case TSK_ExplicitSpecialization:
- case TSK_Undeclared:
- // Implicit instantiations can ignore the possibility of an
- // explicit instantiation declaration because there necessarily
- // must be an EI definition somewhere with default visibility.
- case TSK_ImplicitInstantiation:
- // If there's a key function, there may be translation units
- // that don't have the key function's definition.
- if (!CGM.Context.getKeyFunction(RD))
- // Otherwise, drop the visibility to hidden.
- VTable->setVisibility(llvm::GlobalValue::HiddenVisibility);
- break;
-
- // We have to disable the optimization if this is an EI definition
- // because there might be EI declarations in other shared objects.
- case TSK_ExplicitInstantiationDefinition:
- case TSK_ExplicitInstantiationDeclaration:
- break;
- }
- }
+ CGM.setTypeVisibility(VTable, RD, /*ForRTTI*/ false);
}
llvm::GlobalVariable *