diff options
author | John McCall <rjmccall@apple.com> | 2010-08-05 20:39:18 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-08-05 20:39:18 +0000 |
commit | 5513fce96b884195bbdb5c12e428490666514cdc (patch) | |
tree | eb99d485884af20b43e9add1ed674ea89c2eb0a6 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | fa5d2415b64cd5f6ef942ec6d06dea2a67185c73 (diff) | |
download | bcm5719-llvm-5513fce96b884195bbdb5c12e428490666514cdc.tar.gz bcm5719-llvm-5513fce96b884195bbdb5c12e428490666514cdc.zip |
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.
llvm-svn: 110374
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 63384025799..297aa4524e3 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -229,6 +229,9 @@ void CodeGenModule::setTypeVisibility(llvm::GlobalValue *GV, // This isn't possible if there might be unresolved references // elsewhere that rely on this symbol being visible. + // This should be kept roughly in sync with setThunkVisibility + // in CGVTables.cpp. + // Preconditions. if (GV->getLinkage() != llvm::GlobalVariable::WeakODRLinkage || GV->getVisibility() != llvm::GlobalVariable::DefaultVisibility) @@ -245,16 +248,20 @@ void CodeGenModule::setTypeVisibility(llvm::GlobalValue *GV, case TSK_ExplicitInstantiationDeclaration: return; - // Every use of a non-template or explicitly-specialized class's - // type information has to emit it. - case TSK_ExplicitSpecialization: + // Every use of a non-template class's type information has to emit it. 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. + // In theory, implicit instantiations can ignore the possibility of + // an explicit instantiation declaration because there necessarily + // must be an EI definition somewhere with default visibility. In + // practice, it's possible to have an explicit instantiation for + // an arbitrary template class, and linkers aren't necessarily able + // to deal with mixed-visibility symbols. + case TSK_ExplicitSpecialization: case TSK_ImplicitInstantiation: + if (!CodeGenOpts.EmitWeakTemplatesHidden) + return; break; } |