aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGVTables.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-08-05 20:39:18 +0000
committerJohn McCall <rjmccall@apple.com>2010-08-05 20:39:18 +0000
commit7a536907da776bdc47a704e7cafd641e8150e653 (patch)
tree3088d52bb8305a2f6d6d8250d84f966fadd6e03b /lib/CodeGen/CGVTables.cpp
parent86e83730b5c1dd9d38b9c9317abbf691a617d63f (diff)
It turns out that linkers (at least, the Darwin linker) don't necessarily
do the right thing with mixed-visibility symbols, so disable the visibility optimization where that's possible, i.e. with template classes (since it's possible that an arbitrary template might be subject to an explicit instantiation elsewhere). 447.dealII actually does this. I've put the code under an option that's currently not hooked up to anything. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110374 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVTables.cpp')
-rw-r--r--lib/CodeGen/CGVTables.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/CodeGen/CGVTables.cpp b/lib/CodeGen/CGVTables.cpp
index cd34d03cd7..494176a906 100644
--- a/lib/CodeGen/CGVTables.cpp
+++ b/lib/CodeGen/CGVTables.cpp
@@ -15,6 +15,7 @@
#include "CodeGenFunction.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/RecordLayout.h"
+#include "clang/Frontend/CodeGenOptions.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Support/Compiler.h"
@@ -2469,34 +2470,29 @@ static void setThunkVisibility(CodeGenModule &CGM, const CXXMethodDecl *MD,
// emit its thunks with hidden visibility, since its thunks must be
// emitted when the function is.
- // This mostly follows CodeGenModule::setTypeVisibility.
+ // This follows CodeGenModule::setTypeVisibility; see the comments
+ // there for explanation.
if ((Fn->getLinkage() != llvm::GlobalVariable::LinkOnceODRLinkage &&
Fn->getLinkage() != llvm::GlobalVariable::WeakODRLinkage) ||
Fn->getVisibility() != llvm::GlobalVariable::DefaultVisibility)
return;
- // Don't override an explicit visibility attribute.
if (MD->hasAttr<VisibilityAttr>())
return;
switch (MD->getTemplateSpecializationKind()) {
- // 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:
return;
- // Every use of a non-template or explicitly-specialized class's
- // type information has to emit it.
- case TSK_ExplicitSpecialization:
case TSK_Undeclared:
break;
- // 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_ExplicitSpecialization:
case TSK_ImplicitInstantiation:
+ if (!CGM.getCodeGenOpts().EmitWeakTemplatesHidden)
+ return;
break;
}