forked from OSchip/llvm-project
Fix the visibility of methods of explicit template instantiation definition
when using -fvisibility-inlines-hidden. This matches gcc's behavior and documentation. Fixes PR11642. llvm-svn: 147295
This commit is contained in:
parent
46236ee5cf
commit
0b79046c5c
|
@ -568,6 +568,7 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D, LVFlags F) {
|
|||
// about whether containing classes have visibility attributes,
|
||||
// and that's intentional.
|
||||
if (TSK != TSK_ExplicitInstantiationDeclaration &&
|
||||
TSK != TSK_ExplicitInstantiationDefinition &&
|
||||
F.ConsiderGlobalVisibility &&
|
||||
MD->getASTContext().getLangOptions().InlineVisibilityHidden) {
|
||||
// InlineVisibilityHidden only applies to definitions, and
|
||||
|
|
|
@ -97,3 +97,14 @@ namespace test2 {
|
|||
|
||||
// CHECK: define available_externally void @_ZN5test22ns3fooINS_1BINS_1AEEEEEvv()
|
||||
}
|
||||
|
||||
namespace PR11642 {
|
||||
template <typename T>
|
||||
class Foo {
|
||||
public:
|
||||
T foo(T x) { return x; }
|
||||
};
|
||||
extern template class Foo<int>;
|
||||
template class Foo<int>;
|
||||
// CHECK: define weak_odr i32 @_ZN7PR116423FooIiE3fooEi
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue